Skip to contentSkip to conversation

nft: fix leak of iterators

PATCH Applied Giuseppe Longo 2 participants 2 messages Jun 8, 2013 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nft: fix leak of iterators

This patch fix leak of iterators

---
 iptables/nft.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
iptables/nft.c +6 -0
index c18999b..5a0b814 100644
@@ -1112,6 +1112,7 @@ next:
 		c = nft_chain_list_iter_next(iter);
 	}
 
+	nft_chain_list_iter_destroy(iter);
 	nft_chain_list_free(list);
 
 	return 1;
@@ -1200,6 +1201,7 @@ next:
 		r = nft_rule_list_iter_next(iter);
 	}
 
+	nft_rule_list_iter_destroy(iter);
 	nft_rule_list_free(list);
 
 	/* the core expects 1 for success and 0 for error */
@@ -1276,6 +1278,8 @@ int nft_rule_flush(struct nft_handle *h, const char *chain, const char *table)
 next:
 		c = nft_chain_list_iter_next(iter);
 	}
+	
+	nft_chain_list_iter_destroy(iter);
 
 err:
 	nft_chain_list_free(list);
@@ -1390,6 +1394,8 @@ next:
 		c = nft_chain_list_iter_next(iter);
 	}
 
+	nft_chain_list_iter_destroy(iter);
+
 err:
 	nft_chain_list_free(list);
 
maintainer Applied
#1 lore raw
Quoted 1 line · Giuseppe Longo

This patch fix leak of iterators

Applied, thanks Giuseppe.

We are still leaking list objects (track function nft_rule_list_get) it has to be released as well. Can you send me a patch for that as well?

Thanks.