|
|
43fe83 |
From ed02ed00086992e3e7445a2938fe5ef5006781f3 Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <ed02ed00086992e3e7445a2938fe5ef5006781f3.1381871411.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: Gao feng <gaofeng@cn.fujitsu.com>
|
|
|
43fe83 |
Date: Mon, 7 Oct 2013 17:17:32 +0100
|
|
|
43fe83 |
Subject: [PATCH] Free cmd in virNetDevVethDelete
|
|
|
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 524b21979a59b825c5547717bcb38b5e3ff0fa67)
|
|
|
43fe83 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
43fe83 |
---
|
|
|
43fe83 |
src/util/virnetdevveth.c | 14 ++++++++++----
|
|
|
43fe83 |
1 file changed, 10 insertions(+), 4 deletions(-)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
|
|
|
43fe83 |
index 403961b..ea49053 100644
|
|
|
43fe83 |
--- a/src/util/virnetdevveth.c
|
|
|
43fe83 |
+++ b/src/util/virnetdevveth.c
|
|
|
43fe83 |
@@ -196,18 +196,24 @@ int virNetDevVethDelete(const char *veth)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
virCommandPtr cmd = virCommandNewArgList("ip", "link", "del", veth, NULL);
|
|
|
43fe83 |
int status;
|
|
|
43fe83 |
+ int ret = -1;
|
|
|
43fe83 |
|
|
|
43fe83 |
if (virCommandRun(cmd, &status) < 0)
|
|
|
43fe83 |
- return -1;
|
|
|
43fe83 |
+ goto cleanup;
|
|
|
43fe83 |
|
|
|
43fe83 |
if (status != 0) {
|
|
|
43fe83 |
if (!virNetDevExists(veth)) {
|
|
|
43fe83 |
VIR_DEBUG("Device %s already deleted (by kernel namespace cleanup)", veth);
|
|
|
43fe83 |
- return 0;
|
|
|
43fe83 |
+ ret = 0;
|
|
|
43fe83 |
+ goto cleanup;
|
|
|
43fe83 |
}
|
|
|
43fe83 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
43fe83 |
_("Failed to delete veth device %s"), veth);
|
|
|
43fe83 |
- return -1;
|
|
|
43fe83 |
+ goto cleanup;
|
|
|
43fe83 |
}
|
|
|
43fe83 |
- return 0;
|
|
|
43fe83 |
+
|
|
|
43fe83 |
+ ret = 0;
|
|
|
43fe83 |
+cleanup:
|
|
|
43fe83 |
+ virCommandFree(cmd);
|
|
|
43fe83 |
+ return ret;
|
|
|
43fe83 |
}
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.3.2
|
|
|
43fe83 |
|