Blob Blame History Raw
From d6fe3f01e405113c9ff5ada2d75e62530608d353 Mon Sep 17 00:00:00 2001
Message-Id: <d6fe3f01e405113c9ff5ada2d75e62530608d353.1381871411.git.jdenemar@redhat.com>
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Mon, 7 Oct 2013 17:17:29 +0100
Subject: [PATCH] Avoid deleting NULL veth device name

For

  https://bugzilla.redhat.com/show_bug.cgi?id=1014604

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@redhat.com>
(cherry picked from commit 8766e9b5a56109155b5c952af91d384d7e0555ec)
Signed-off-by: Jiri Denemark <jdenemar@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 bc9bdfb..47e6dd7 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -1280,7 +1280,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.2