netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libnetfilter_queue] Stop a memory leak in nfq_close
@ 2024-05-06 23:17 Duncan Roe
  2024-06-05 15:19 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 5+ messages in thread
From: Duncan Roe @ 2024-05-06 23:17 UTC (permalink / raw)
  To: netfilter-devel

0c5e5fb introduced struct nfqnl_q_handle *qh_list which can point to
dynamically acquired memory. Without this patch, that memory is not freed.

Fixes: 0c5e5fb15205 ("sync with all 'upstream' changes in libnfnetlink_log")
Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
 src/libnetfilter_queue.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/libnetfilter_queue.c b/src/libnetfilter_queue.c
index bf67a19..f152efb 100644
--- a/src/libnetfilter_queue.c
+++ b/src/libnetfilter_queue.c
@@ -481,7 +481,13 @@ EXPORT_SYMBOL
 int nfq_close(struct nfq_handle *h)
 {
 	int ret;
+	struct nfq_q_handle *qh;
 
+	while (h->qh_list) {
+		qh = h->qh_list;
+		h->qh_list = qh->next;
+		free(qh);
+	}
 	ret = nfnl_close(h->nfnlh);
 	if (ret == 0)
 		free(h);
-- 
2.35.8


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-13  3:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 23:17 [PATCH libnetfilter_queue] Stop a memory leak in nfq_close Duncan Roe
2024-06-05 15:19 ` Pablo Neira Ayuso
2024-06-11  2:46   ` Duncan Roe
2024-06-11 22:21     ` Pablo Neira Ayuso
2024-06-13  3:09       ` Duncan Roe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).