]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Rework virDomainEmulatorPinDefParseXML
authorJohn Ferlan <jferlan@redhat.com>
Wed, 20 Feb 2019 16:07:07 +0000 (11:07 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 4 Mar 2019 12:09:06 +0000 (07:09 -0500)
In preparation for using auto free mechanism, change to using the
VIR_STEAL_PTR on @def to @ret and of course be sure to properly clean
up @def in cleanup.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/conf/domain_conf.c

index 477deb777e2bf3fc627ea7bedeec0aa986a738ec..9b0dbe3c91a3f81b471a7d4c98b177754e522df6 100644 (file)
@@ -18397,6 +18397,7 @@ static virBitmapPtr
 virDomainEmulatorPinDefParseXML(xmlNodePtr node)
 {
     virBitmapPtr def = NULL;
+    virBitmapPtr ret = NULL;
     char *tmp = NULL;
 
     if (!(tmp = virXMLPropString(node, "cpuset"))) {
@@ -18411,14 +18412,15 @@ virDomainEmulatorPinDefParseXML(xmlNodePtr node)
     if (virBitmapIsAllClear(def)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Invalid value of 'cpuset': %s"), tmp);
-        virBitmapFree(def);
-        def = NULL;
         goto cleanup;
     }
 
+    VIR_STEAL_PTR(ret, def);
+
  cleanup:
+    virBitmapFree(def);
     VIR_FREE(tmp);
-    return def;
+    return ret;
 }