From 712bb639935e43a31fcc0b8f6c38b35f459df30a Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Sun, 30 Nov 2008 17:15:04 +0100 Subject: Fix memory leak in destructor_nfct(). This patch fixes a memory leak in the destructor function which was not releasing the memory allocated for each connection tracking entry. --- input/flow/ulogd_inpflow_NFCT.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'input') diff --git a/input/flow/ulogd_inpflow_NFCT.c b/input/flow/ulogd_inpflow_NFCT.c index a39bf08..244454b 100644 --- a/input/flow/ulogd_inpflow_NFCT.c +++ b/input/flow/ulogd_inpflow_NFCT.c @@ -692,6 +692,14 @@ 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); + return 0; +} + + static int do_purge(void *data1, void *data2) { int ret; @@ -887,6 +895,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); -- cgit v1.2.3