[ULOGD2 PATCH 17/18] Fix memory leak in destructor_nfct().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes a memroy leak in the destructor function which was not
releasing the memory allocated for each connection tracking entry.

Signed-off-by: Eric Leblond <eric@xxxxxx>
---
 input/flow/ulogd_inpflow_NFCT.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/input/flow/ulogd_inpflow_NFCT.c b/input/flow/ulogd_inpflow_NFCT.c
index a39bf08..1730ec9 100644
--- a/input/flow/ulogd_inpflow_NFCT.c
+++ b/input/flow/ulogd_inpflow_NFCT.c
@@ -692,6 +692,13 @@ static int read_cb_nfct(int fd, unsigned int what, void *param)
 	return 0;
 }
 
+static int do_free(void *data1, void *data2)
+{
+	struct ct_timestamp *ts = data2;
+	free(ts->ct);
+}
+
+
 static int do_purge(void *data1, void *data2)
 {
 	int ret;
@@ -887,6 +894,9 @@ static int destructor_nfct(struct ulogd_pluginstance *pi)
 	struct nfct_pluginstance *cpi = (void *) pi->private;
 	int rc;
 
+	/* free existent entries */
+	hashtable_iterate(cpi->ct_active, NULL, do_free);
+
 	hashtable_destroy(cpi->ct_active);
 
 	rc = nfct_close(cpi->cth);
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux