Skip to contentSkip to conversation

Fix minor memory leak.

PATCH In review Eric Leblond 1 participant 2 messages Nov 30, 2008 – Dec 15, 2008 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix minor memory leak.

The nflog_handle is allocated in nflog_open(). This patch adds the missing free in nlog_close().

---
 src/libnetfilter_log.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
src/libnetfilter_log.c +3 -1
index 6c0936e..216cdb8 100644
@@ -237,7 +237,9 @@ int nflog_handle_packet(struct nflog_handle *h, char *buf, int len)
 
 int nflog_close(struct nflog_handle *h)
 {
-	return nfnl_close(h->nfnlh);
+	int ret = nfnl_close(h->nfnlh);
+	free(h);
+	return ret;
 }
 
 /* bind nf_queue from a specific protocol family */
Signature · 1 line
1.5.6.3
#1 lore raw

Hi,

This patch has been applied to libnetfilter_log git tree.

Quoted 13 lines · Eric Leblond

The nflog_handle is allocated in nflog_open(). This patch adds the missing free in nflog_close().

---
 src/libnetfilter_log.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
src/libnetfilter_log.c +0 -0
index 6c0936e..216cdb8 100644

src/libnetfilter_log.c int nflog_handle_packet(struct nflog_handle *h, char *buf, int len) · line 245

Quoted 10 lines
src/libnetfilter_log.c +3 -1
@@ -237,7 +237,9 @@ int nflog_handle_packet(struct nflog_handle *h, char *buf, int len)
 
 int nflog_close(struct nflog_handle *h)
 {
-	return nfnl_close(h->nfnlh);
+	int ret = nfnl_close(h->nfnlh);
+	free(h);
+	return ret;
 }
 
 /* bind nf_queue from a specific protocol family */

BR,

Signature · 3 lines
Éric Leblond <[email protected]>
INL, http://www.inl.fr/
NuFW, http://www.nufw.org