render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
43fe83
From 7a032ce726b449746310965777e1b18e531c38b8 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <7a032ce726b449746310965777e1b18e531c38b8.1381871411.git.jdenemar@redhat.com>
43fe83
From: Gao feng <gaofeng@cn.fujitsu.com>
43fe83
Date: Mon, 7 Oct 2013 17:17:33 +0100
43fe83
Subject: [PATCH] Free cmd in virNetDevVethCreate
43fe83
43fe83
For
43fe83
43fe83
  https://bugzilla.redhat.com/show_bug.cgi?id=1014604
43fe83
43fe83
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
43fe83
(cherry picked from commit 391b82722ef44df993d21332a06ccdd5e3500306)
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
---
43fe83
 src/util/virnetdevveth.c | 6 +++++-
43fe83
 1 file changed, 5 insertions(+), 1 deletion(-)
43fe83
43fe83
diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
43fe83
index ea49053..25eb282 100644
43fe83
--- a/src/util/virnetdevveth.c
43fe83
+++ b/src/util/virnetdevveth.c
43fe83
@@ -110,6 +110,7 @@ int virNetDevVethCreate(char** veth1, char** veth2)
43fe83
     char *veth1auto = NULL;
43fe83
     char *veth2auto = NULL;
43fe83
     int vethNum = 0;
43fe83
+    virCommandPtr cmd = NULL;
43fe83
     size_t i;
43fe83
 
43fe83
     /*
43fe83
@@ -139,7 +140,7 @@ int virNetDevVethCreate(char** veth1, char** veth2)
43fe83
             vethNum = veth2num + 1;
43fe83
         }
43fe83
 
43fe83
-        virCommandPtr cmd = virCommandNew("ip");
43fe83
+        cmd = virCommandNew("ip");
43fe83
         virCommandAddArgList(cmd, "link", "add",
43fe83
                              *veth1 ? *veth1 : veth1auto,
43fe83
                              "type", "veth", "peer", "name",
43fe83
@@ -169,6 +170,8 @@ int virNetDevVethCreate(char** veth1, char** veth2)
43fe83
                   status);
43fe83
         VIR_FREE(veth1auto);
43fe83
         VIR_FREE(veth2auto);
43fe83
+        virCommandFree(cmd);
43fe83
+        cmd = NULL;
43fe83
     }
43fe83
 
43fe83
     virReportError(VIR_ERR_INTERNAL_ERROR,
43fe83
@@ -176,6 +179,7 @@ int virNetDevVethCreate(char** veth1, char** veth2)
43fe83
                    MAX_VETH_RETRIES);
43fe83
 
43fe83
 cleanup:
43fe83
+    virCommandFree(cmd);
43fe83
     VIR_FREE(veth1auto);
43fe83
     VIR_FREE(veth2auto);
43fe83
     return ret;
43fe83
-- 
43fe83
1.8.3.2
43fe83