diff options
author | Phil Sutter <phil@nwl.cc> | 2022-11-25 19:30:09 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2022-12-02 01:44:17 +0100 |
commit | 73da7fb74c1089391dac0aca70e13e5f5999ace7 (patch) | |
tree | 489c7e18f828c922f4767b69d9cfc9089a4456cf /iptables | |
parent | 18880dbde615449d00a3e38f3713a19d4566258e (diff) |
iptables-xml: Free allocated chain strings
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@ufomechanic.net>)")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables')
-rw-r--r-- | iptables/iptables-xml.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/iptables/iptables-xml.c b/iptables/iptables-xml.c index d28cf748..396c0a12 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; } |