forked from github/server
fix group.test leaks
This commit is contained in:
parent
a281ace21b
commit
d5261ab1da
|
@ -125,10 +125,14 @@ attrib_type at_group = { /* attribute for units assigned to a group */
|
||||||
|
|
||||||
void free_group(group * g)
|
void free_group(group * g)
|
||||||
{
|
{
|
||||||
int index = g->gid % GMAXHASH;
|
int index;
|
||||||
group **g_ptr = ghash + index;
|
group **g_ptr;
|
||||||
while (*g_ptr && (*g_ptr)->gid != g->gid)
|
assert(g);
|
||||||
|
index = g->gid % GMAXHASH;
|
||||||
|
g_ptr = ghash + index;
|
||||||
|
while (*g_ptr && (*g_ptr)->gid != g->gid) {
|
||||||
g_ptr = &(*g_ptr)->nexthash;
|
g_ptr = &(*g_ptr)->nexthash;
|
||||||
|
}
|
||||||
assert(*g_ptr == g);
|
assert(*g_ptr == g);
|
||||||
*g_ptr = g->nexthash;
|
*g_ptr = g->nexthash;
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,7 @@ static void test_group_readwrite(CuTest * tc)
|
||||||
write_groups(&store, f);
|
write_groups(&store, f);
|
||||||
WRITE_INT(&store, 47);
|
WRITE_INT(&store, 47);
|
||||||
|
|
||||||
|
free_group(f->groups);
|
||||||
free_group(g);
|
free_group(g);
|
||||||
f->groups = 0;
|
f->groups = 0;
|
||||||
data.strm.api->rewind(data.strm.handle);
|
data.strm.api->rewind(data.strm.handle);
|
||||||
|
|
Loading…
Reference in New Issue