提交 3379193f 编写于 作者: P Pavel Hrdina

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: NDaniel P. Berrangé <berrange@redhat.com>
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 8ac95faf
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册