git.haldean.org expel / d82cf2e
fix mem management in load_save unit Haldean Brown 6 years ago
1 changed file(s) with 4 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
6969
7070 v = calloc(1, sizeof(struct xl_value));
7171 assert(xl_value_load(v, &s) == OK);
72 assert(xl_take(v) == OK);
7273
7374 /* make sure tags are correct. */
7475 assert(v->tag == u[0].tag);
7879 assert(v->right.t->left.t->right.t->tag == u[4].tag);
7980 assert(v->right.t->left.t->left.t->left.t->tag == u[5].tag);
8081
81 /* make sure refcounts are all 1 except the root, which is not taken. */
82 assert(v->refcount == 0);
82 /* make sure refcounts are all 1 except the root. */
83 assert(v->refcount == 1);
8384 assert(v->right.t->refcount == 1);
8485 assert(v->right.t->left.t->refcount == 1);
8586 assert(v->right.t->left.t->left.t->refcount == 1);
108109
109110 xl_stream_close(&s);
110111 free(u);
111 free(v);
112 assert(xl_release(v) == OK);
112113
113114 return ok;
114115 }