From: Pavel Hrdina Date: Thu, 28 Jun 2018 07:53:48 +0000 (+0200) Subject: nwfilter: Remove redundant check if object exists X-Git-Tag: v4.6.0-rc1~321 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3379193f1c73a7be6bd797a3cf790e6960195d3a;p=thirdparty%2Flibvirt.git nwfilter: Remove redundant check if object exists 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é Signed-off-by: Pavel Hrdina --- diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index ed34586105..ac3a964388 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -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)