]> xenbits.xensource.com Git - libvirt.git/commitdiff
nwfilter: Remove redundant check if object exists
authorPavel Hrdina <phrdina@redhat.com>
Thu, 28 Jun 2018 07:53:48 +0000 (09:53 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 4 Jul 2018 05:23:08 +0000 (07:23 +0200)
The same check is done by virNWFilterBindingObjListAdd().  The main
issue with the current code is that if the object already exists we
would leak 'def' because 'obj' would be set and the cleanup code frees
'def' only if 'obj' is NULL.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
src/nwfilter/nwfilter_driver.c

index ed34586105222f9b5f6a894b06ff9d7e85f198b1..ac3a96438855649dd7cc6b394c133c248ae1725a 100644 (file)
@@ -752,13 +752,6 @@ nwfilterBindingCreateXML(virConnectPtr conn,
     if (virNWFilterBindingCreateXMLEnsureACL(conn, def) < 0)
         goto cleanup;
 
-    obj = virNWFilterBindingObjListFindByPortDev(driver->bindings, def->portdevname);
-    if (obj) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Filter already present for NIC %s"), def->portdevname);
-        goto cleanup;
-    }
-
     obj = virNWFilterBindingObjListAdd(driver->bindings,
                                        def);
     if (!obj)