render / rpms / libvirt

Forked from rpms/libvirt 4 months ago
Clone
25aafc
From fb8458440bb6c36a04400f83595da821dd445039 Mon Sep 17 00:00:00 2001
25aafc
Message-Id: <fb8458440bb6c36a04400f83595da821dd445039@dist-git>
25aafc
From: Pavel Hrdina <phrdina@redhat.com>
25aafc
Date: Fri, 29 Nov 2019 08:54:55 +0100
25aafc
Subject: [PATCH] nwfilter: Remove redundant check if object exists
25aafc
MIME-Version: 1.0
25aafc
Content-Type: text/plain; charset=UTF-8
25aafc
Content-Transfer-Encoding: 8bit
25aafc
25aafc
The same check is done by virNWFilterBindingObjListAdd().  The main
25aafc
issue with the current code is that if the object already exists we
25aafc
would leak 'def' because 'obj' would be set and the cleanup code frees
25aafc
'def' only if 'obj' is NULL.
25aafc
25aafc
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
25aafc
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
25aafc
(cherry picked from commit 3379193f1c73a7be6bd797a3cf790e6960195d3a)
25aafc
25aafc
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1766475
25aafc
25aafc
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
25aafc
Message-Id: <22531b7498d6fc2609c654d6efab9e5b2eac3819.1575014076.git.phrdina@redhat.com>
25aafc
Reviewed-by: Ján Tomko <jtomko@redhat.com>
25aafc
---
25aafc
 src/nwfilter/nwfilter_driver.c | 7 -------
25aafc
 1 file changed, 7 deletions(-)
25aafc
25aafc
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
25aafc
index ed34586105..ac3a964388 100644
25aafc
--- a/src/nwfilter/nwfilter_driver.c
25aafc
+++ b/src/nwfilter/nwfilter_driver.c
25aafc
@@ -752,13 +752,6 @@ nwfilterBindingCreateXML(virConnectPtr conn,
25aafc
     if (virNWFilterBindingCreateXMLEnsureACL(conn, def) < 0)
25aafc
         goto cleanup;
25aafc
 
25aafc
-    obj = virNWFilterBindingObjListFindByPortDev(driver->bindings, def->portdevname);
25aafc
-    if (obj) {
25aafc
-        virReportError(VIR_ERR_INTERNAL_ERROR,
25aafc
-                       _("Filter already present for NIC %s"), def->portdevname);
25aafc
-        goto cleanup;
25aafc
-    }
25aafc
-
25aafc
     obj = virNWFilterBindingObjListAdd(driver->bindings,
25aafc
                                        def);
25aafc
     if (!obj)
25aafc
-- 
25aafc
2.24.0
25aafc