]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Don't return memory device config on error in qemuBuildMemoryBackendStr
authorPeter Krempa <pkrempa@redhat.com>
Mon, 23 Mar 2015 13:17:42 +0000 (14:17 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 23 Mar 2015 13:20:53 +0000 (14:20 +0100)
In the last section if the function determines that the config is
invalid when QEMU doesn't support the memory device the JSON config
object would be returned even if it doesn't make sense.

Assign the object to be returned only on success.

src/qemu/qemu_command.c

index 63d43d41aff56fd5957cd3e3b71b88c7fde9c6de..04e7bcc85ffffefd24e89952fd72cd4d6dd82ea8 100644 (file)
@@ -4750,9 +4750,6 @@ qemuBuildMemoryBackendStr(unsigned long long size,
             goto cleanup;
     }
 
-    *backendProps = props;
-    props = NULL;
-
     if (!hugepage) {
         bool nodeSpecified = virDomainNumatuneNodeSpecified(def->numa, guestNode);
 
@@ -4767,11 +4764,15 @@ qemuBuildMemoryBackendStr(unsigned long long size,
         /* report back that using the new backend is not necessary to achieve
          * the desired configuration */
         if (!userNodeset && !nodeSpecified) {
+            *backendProps = props;
+            props = NULL;
             ret = 1;
             goto cleanup;
         }
     }
 
+    *backendProps = props;
+    props = NULL;
     ret = 0;
 
  cleanup: