From: John Ferlan Date: Tue, 22 Jan 2013 22:09:26 +0000 (-0500) Subject: lxc_process: Avoid passing NULL iface->iname X-Git-Tag: v1.0.2-rc1~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=73cdac3f72d202ab435d57841821b0e73fd4161d;p=thirdparty%2Flibvirt.git lxc_process: Avoid passing NULL iface->iname A followon to commit id: 68dceb635 - if iface->iname is NULL, then neither virNetDevOpenvswitchRemovePort() nor virNetDevVethDelete() should be called. Found by Coverity. --- diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 4ad7ba08ed..5598a86ffd 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -262,13 +262,15 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver, for (i = 0 ; i < vm->def->nnets ; i++) { virDomainNetDefPtr iface = vm->def->nets[i]; vport = virDomainNetGetActualVirtPortProfile(iface); - if (iface->ifname) + if (iface->ifname) { ignore_value(virNetDevSetOnline(iface->ifname, false)); - if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) - ignore_value(virNetDevOpenvswitchRemovePort( - virDomainNetGetActualBridgeName(iface), - iface->ifname)); - ignore_value(virNetDevVethDelete(iface->ifname)); + if (vport && + vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) + ignore_value(virNetDevOpenvswitchRemovePort( + virDomainNetGetActualBridgeName(iface), + iface->ifname)); + ignore_value(virNetDevVethDelete(iface->ifname)); + } networkReleaseActualDevice(iface); }