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é <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2018-06-28 09:53:48 +02:00
parent 8ac95faf45
commit 3379193f1c

View 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)