[libvirt PATCH v6 12/15] xen_xm: Adapt xenParseXMInputDevs 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_xm.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c
index a476401183..4bff727e04 100644
--- a/src/xenconfig/xen_xm.c
+++ b/src/xenconfig/xen_xm.c
@@ -422,17 +422,18 @@ static int
 xenParseXMInputDevs(virConfPtr conf, virDomainDefPtr def)
 {
     const char *str;
+    int ret = -1;
 
     if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
         if (xenConfigGetString(conf, "usbdevice", &str, NULL) < 0)
-            return -1;
+            goto cleanup;
         if (str &&
                 (STREQ(str, "tablet") ||
                  STREQ(str, "mouse") ||
                  STREQ(str, "keyboard"))) {
             virDomainInputDefPtr input;
             if (VIR_ALLOC(input) < 0)
-                return -1;
+                goto cleanup;
 
             input->bus = VIR_DOMAIN_INPUT_BUS_USB;
             if (STREQ(str, "mouse"))
@@ -443,11 +444,14 @@ xenParseXMInputDevs(virConfPtr conf, virDomainDefPtr def)
                 input->type = VIR_DOMAIN_INPUT_TYPE_KBD;
             if (VIR_APPEND_ELEMENT(def->inputs, def->ninputs, input) < 0) {
                 virDomainInputDefFree(input);
-                return -1;
+                goto cleanup;
             }
         }
     }
-    return 0;
+    ret = 0;
+
+ cleanup:
+    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