]> xenbits.xensource.com Git - libvirt.git/commitdiff
plug two leaks
authorJim Meyering <meyering@redhat.com>
Fri, 16 May 2008 16:53:44 +0000 (16:53 +0000)
committerJim Meyering <meyering@redhat.com>
Fri, 16 May 2008 16:53:44 +0000 (16:53 +0000)
* src/qemu_conf.c (qemudParseXML): Free "obj" unconditionally.

ChangeLog
src/qemu_conf.c

index dfdaf6ff7d7f6f4afd7575cd5b18c61e9d0763b8..f85cfe6fab2cc50b2ba6ff45aa1fc42b1417cfa1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri May 16 18:53:12 CEST 2008 Jim Meyering <meyering@redhat.com>
+
+       plug two leaks
+       * src/qemu_conf.c (qemudParseXML): Free "obj" unconditionally.
+
 Fri May 16 12:50:08 EST 2008 Daniel P. Berrange <berrange@redhat.com>
 
        Make QEMU test cases independant of QEMU capabilities on
index dfe28696b4347eb2f5383ff00757760856c5128d..d6afe59291d9a47c57c550647a71346ae83f8145 100644 (file)
@@ -1716,11 +1716,11 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
         (obj->stringval != NULL) && (obj->stringval[0] != 0)) {
         strncpy(def->os.bootloader, (const char*)obj->stringval, sizeof(def->os.bootloader));
         NUL_TERMINATE(def->os.bootloader);
-        xmlXPathFreeObject(obj);
 
         /* Set a default OS type, since <type> is optional with bootloader */
         strcpy(def->os.type, "xen");
     }
+    xmlXPathFreeObject(obj);
 
     /* Extract OS type info */
     obj = xmlXPathEval(BAD_CAST "string(/domain/os/type[1])", ctxt);
@@ -1733,9 +1733,9 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
         }
     } else {
         strcpy(def->os.type, (const char *)obj->stringval);
-        xmlXPathFreeObject(obj);
-        obj = NULL;
     }
+    xmlXPathFreeObject(obj);
+    obj = NULL;
 
     if (!virCapabilitiesSupportsGuestOSType(driver->caps, def->os.type)) {
         qemudReportError(conn, NULL, NULL, VIR_ERR_OS_TYPE,