diff options
author | Eric Leblond <eric@inl.fr> | 2008-11-30 17:15:04 +0100 |
---|---|---|
committer | Eric Leblond <eric@inl.fr> | 2008-12-09 01:19:25 +0100 |
commit | 712bb639935e43a31fcc0b8f6c38b35f459df30a (patch) | |
tree | dcf7df68a793ab3d81bffbed59a1ff575428fff3 /input/flow/ulogd_inpflow_NFCT.c | |
parent | 5efa8937ed569dcd925c4c55f591f4d1a50c6316 (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.
Diffstat (limited to 'input/flow/ulogd_inpflow_NFCT.c')
-rw-r--r-- | input/flow/ulogd_inpflow_NFCT.c | 11 |
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); |