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