From: Wang King Date: Wed, 12 Apr 2017 07:58:23 +0000 (+0800) Subject: interface: Fix resource leak in netcfConnectListAllInterfaces error path X-Git-Tag: v3.3.0-rc1~198 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b1b045915bec4cbc6ed087c96be4b1de8953002;p=thirdparty%2Flibvirt.git interface: Fix resource leak in netcfConnectListAllInterfaces error path On virGetInterface failure, call virInterfaceDefFree for the @def. --- diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c index 700a8a075c..c7cc07122a 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c @@ -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++;