|
|
43fe83 |
From a2d2939673d2e77d1297ae054795fd337dd0a95f Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <a2d2939673d2e77d1297ae054795fd337dd0a95f.1377873641.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
43fe83 |
Date: Wed, 28 Aug 2013 10:24:09 +0200
|
|
|
43fe83 |
Subject: [PATCH] virsh: free the caps list properly if one of them is invalid
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=1001957
|
|
|
43fe83 |
|
|
|
43fe83 |
VIR_FREE(caps) is not enough to free an array allocated
|
|
|
43fe83 |
by vshStringToArray.
|
|
|
43fe83 |
|
|
|
43fe83 |
==17== 4 bytes in 1 blocks are definitely lost in loss record 4 of 728
|
|
|
43fe83 |
==17== by 0x4EFFC44: virStrdup (virstring.c:554)
|
|
|
43fe83 |
==17== by 0x128B10: _vshStrdup (virsh.c:125)
|
|
|
43fe83 |
==17== by 0x129164: vshStringToArray (virsh.c:218)
|
|
|
43fe83 |
==17== by 0x157BB3: cmdNodeListDevices (virsh-nodedev.c:409)
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=1001536
|
|
|
43fe83 |
(cherry picked from commit 14d5328681448267dfc0812948fa2c6ec4dfa7d4)
|
|
|
43fe83 |
---
|
|
|
43fe83 |
tools/virsh-nodedev.c | 4 ++--
|
|
|
43fe83 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
|
|
|
43fe83 |
index 5522405..92ef40c 100644
|
|
|
43fe83 |
--- a/tools/virsh-nodedev.c
|
|
|
43fe83 |
+++ b/tools/virsh-nodedev.c
|
|
|
43fe83 |
@@ -413,8 +413,8 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
|
|
|
43fe83 |
for (i = 0; i < ncaps; i++) {
|
|
|
43fe83 |
if ((cap_type = virNodeDevCapTypeFromString(caps[i])) < 0) {
|
|
|
43fe83 |
vshError(ctl, "%s", _("Invalid capability type"));
|
|
|
43fe83 |
- VIR_FREE(caps);
|
|
|
43fe83 |
- return false;
|
|
|
43fe83 |
+ ret = false;
|
|
|
43fe83 |
+ goto cleanup;
|
|
|
43fe83 |
}
|
|
|
43fe83 |
|
|
|
43fe83 |
switch (cap_type) {
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.3.2
|
|
|
43fe83 |
|