Commit a791188e authored by Alf-André Walla's avatar Alf-André Walla Committed by Dridi Boukelmoune

genhufdec: Free top table before exit

parent 5f039a4a
......@@ -92,6 +92,16 @@ tbl_new(unsigned mask)
return (tbl);
}
static void
tbl_free(struct tbl* table)
{
for (unsigned i = 0; i < table->n; i++) {
if (table->e[i].next != NULL)
tbl_free(table->e[i].next);
}
free(table);
}
static void
tbl_add(struct tbl *tbl, uint32_t code, unsigned codelen,
uint32_t bits, unsigned len, char chr)
......@@ -250,5 +260,6 @@ main(int argc, const char **argv)
tbl_print(top);
printf("};\n");
tbl_free(top);
return (0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment