[libvirt PATCH v6 09/15] xen_common: Adapt xenParseEmulatedDevices due to changes in xenConfigGetString

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



xenConfigGetString returns a newly-allocated pointer and it has to be
freed by the caller.

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 src/xenconfig/xen_common.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index f787827008..5d88577222 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1060,17 +1060,22 @@ static int
 xenParseEmulatedDevices(virConfPtr conf, virDomainDefPtr def)
 {
     const char *str;
+    int ret = -1;
 
     if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
         if (xenConfigGetString(conf, "soundhw", &str, NULL) < 0)
-            return -1;
+            goto cleanup;
 
         if (str &&
             xenParseSxprSound(def, str) < 0)
-            return -1;
+            goto cleanup;
     }
 
-    return 0;
+    ret = 0;
+
+ cleanup:
+    VIR_FREE(str);
+    return ret;
 }
 
 
-- 
2.17.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux