Freeing only if 'created' is non-zero is wrong - the data was still allocated. In fact, the field is supposed to prevent only the call to openChain(). Fixes: 8d3eccb19a9c6 ("Add iptables-xml tool (Amin Azez <azez@xxxxxxxxxxxxxxx>)") Signed-off-by: Phil Sutter <phil@xxxxxx> --- iptables/iptables-xml.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/iptables/iptables-xml.c b/iptables/iptables-xml.c index d28cf7481b55d..396c0a123ea08 100644 --- a/iptables/iptables-xml.c +++ b/iptables/iptables-xml.c @@ -225,13 +225,13 @@ finishChains(void) { int c; - for (c = 0; c < nextChain; c++) - if (!chains[c].created) { + for (c = 0; c < nextChain; c++) { + if (!chains[c].created) openChain(chains[c].chain, chains[c].policy, &(chains[c].count), '/'); - free(chains[c].chain); - free(chains[c].policy); - } + free(chains[c].chain); + free(chains[c].policy); + } nextChain = 0; } -- 2.38.0