[Chilli] [PATCH] Fix: Memory leak of iphash_new() on error path

Masashi Honma honma at ictec.co.jp
Wed Mar 3 02:47:16 UTC 2010


The allocated "n" is not freed on error path. This patch solves this

Index: iphash.c
--- iphash.c	(revision 295)
+++ iphash.c	(working copy)
@@ -95,6 +95,7 @@
   if (!(n->hash = calloc(sizeof(struct iphashm_t *), n->hashsize))){
     log_err(0, "Failed to allocate memory for iphash");
+    free(n);
     return -1;

Masashi Honma.

More information about the Chilli mailing list