interface: Fix resource leak in netcfConnectListAllInterfaces error path

On virGetInterface failure, call virInterfaceDefFree for the @def.

(cherry picked from commit 1b1b045915bec4cbc6ed087c96be4b1de8953002)
This commit is contained in:
Wang King 2017-04-12 15:58:23 +08:00 committed by Cole Robinson
parent dce5c95c28
commit a7aacb742e

View File

@ -622,8 +622,10 @@ netcfConnectListAllInterfaces(virConnectPtr conn,
}
if (ifaces) {
if (!(iface_obj = virGetInterface(conn, def->name, def->mac)))
if (!(iface_obj = virGetInterface(conn, def->name, def->mac))) {
virInterfaceDefFree(def);
goto cleanup;
}
tmp_iface_objs[niface_objs] = iface_obj;
}
niface_objs++;