[libvirt] [PATCH 3/5] Avoid deleting NULL veth device name

Daniel P. Berrange berrange at redhat.com
Wed Oct 2 11:31:18 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

If veth device allocation has a fatal error, the veths
array may contain NULL device names. Avoid calling the
virNetDevVethDelete function on such names.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 src/lxc/lxc_process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index a78784e..d07ff13 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -1290,7 +1290,7 @@ cleanup:
         rc = -1;
     }
     for (i = 0; i < nveths; i++) {
-        if (rc != 0)
+        if (rc != 0 && veths[i])
             ignore_value(virNetDevVethDelete(veths[i]));
         VIR_FREE(veths[i]);
     }
-- 
1.8.3.1




More information about the libvir-list mailing list