From 74aa3ffec212989375599974e1cb984b1993aa0f Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 23 Nov 2012 16:36:52 +0000 Subject: [PATCH] Avoid crash when LXC start fails with no interface target If the device did not contain any element, LXC would crash on a NULL pointer if starting the container failed Signed-off-by: Daniel P. Berrange (cherry picked from commit 68dceb635d8d8f68e36caf4054c32f0f9cb13c22) --- src/lxc/lxc_process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 079bc3abc4..70513c2e83 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -254,7 +254,8 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver, for (i = 0 ; i < vm->def->nnets ; i++) { virDomainNetDefPtr iface = vm->def->nets[i]; vport = virDomainNetGetActualVirtPortProfile(iface); - ignore_value(virNetDevSetOnline(iface->ifname, false)); + if (iface->ifname) + ignore_value(virNetDevSetOnline(iface->ifname, false)); if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) ignore_value(virNetDevOpenvswitchRemovePort( virDomainNetGetActualBridgeName(iface),