[PATCH 20/25] nwfilter: remove unnecessary code from ebtablesGetSubChainInsts()

Laine Stump laine at redhat.com
Thu Jun 25 03:34:09 UTC 2020

On failure, this function would clear out and free the list of
subchains it had been called with. This is unnecessary, because the
*only* caller of this function will also clear out and free the list
of subchains if it gets a failure from ebtablesGetSubChainInsts().

(It also makes more logical sense for the function that is creating
the entire list to be the one freeing the entire list, rather than
having a function whose purpose is only to create *one item* on the
list freeing the entire list).

Signed-off-by: Laine Stump <laine at redhat.com>
 src/nwfilter/nwfilter_ebiptables_driver.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 89c131e17f..8fdc8e8897 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -3334,12 +3334,6 @@ ebtablesGetSubChainInsts(virHashTablePtr chains,
-    if (ret < 0) {
-        for (i = 0; i < *ninsts; i++)
-            VIR_FREE(*insts[i]);
-        VIR_FREE(*insts);
-        *ninsts = 0;
-    }
     return ret;

More information about the libvir-list mailing list