summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Leblond <eric@inl.fr>2008-11-30 17:15:04 +0100
committerEric Leblond <eric@inl.fr>2008-12-09 01:19:25 +0100
commit712bb639935e43a31fcc0b8f6c38b35f459df30a (patch)
treedcf7df68a793ab3d81bffbed59a1ff575428fff3
parent5efa8937ed569dcd925c4c55f591f4d1a50c6316 (diff)
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.
-rw-r--r--input/flow/ulogd_inpflow_NFCT.c11
1 files changed, 11 insertions, 0 deletions
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);