Memory leak in tests revealed bug in jmap_free. Also, out-by-one
error.
void jmap_free(const struct jmap *map)
{
free((char *)map->errstr);
- Judy1FreeArray((PPvoid_t)&map->judy, PJE0);
+ JudyLFreeArray((PPvoid_t)&map->judy, PJE0);
free((void *)map);
}
int main(int argc, char *argv[])
{
struct jmap_foo *map;
- struct foo *foo[NUM], **foop;
+ struct foo *foo[NUM+1], **foop;
struct idx *idx[NUM+1], *index;
unsigned int i;
ok1(jmap_foo_error(map) == NULL);
jmap_foo_free(map);
+ for (i = 0; i < NUM+1; i++)
+ free(foo[i]);
+
return exit_status();
}
ok1(jmap_foo_error(map) == NULL);
jmap_foo_free(map);
+ for (i = 0; i < NUM; i++)
+ free(foo[i]);
+
return exit_status();
}