[master] a791188e2 genhufdec: Free top table before exit
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 9 15:23:06 UTC 2019
commit a791188e2e8b7782d81d93b465f32cf53e0509f9
Author: Alf-André Walla <fwsgonzo at hotmail.com>
Date: Wed Oct 9 11:13:33 2019 +0200
genhufdec: Free top table before exit
diff --git a/bin/varnishd/hpack/vhp_gen_hufdec.c b/bin/varnishd/hpack/vhp_gen_hufdec.c
index 5f864402a..da0593a94 100644
--- a/bin/varnishd/hpack/vhp_gen_hufdec.c
+++ b/bin/varnishd/hpack/vhp_gen_hufdec.c
@@ -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);
}
More information about the varnish-commit
mailing list