Signed-off-by: Duncan Roe <duncan_roe@xxxxxxxxxxxxxxx> --- src/libnetfilter_queue.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/libnetfilter_queue.c b/src/libnetfilter_queue.c index 03c56ca..db31446 100644 --- a/src/libnetfilter_queue.c +++ b/src/libnetfilter_queue.c @@ -550,12 +550,20 @@ out_free: EXPORT_SYMBOL int nfq_close(struct nfq_handle *h) { - int ret; + struct nfq_q_handle *qh; - ret = nfnl_close(h->nfnlh); - if (ret == 0) - free(h); - return ret; + mnl_socket_close(h->nl); + + while (h->qh_list) { + qh = h->qh_list; + h->qh_list = qh->next; + free(qh); + } + free(h->nfnlssh->cb); + free(h->nfnlh); + free(h); + + return 0; } /** -- 2.35.8