]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Fix bug in finding alloc through matching vcpus
authorWang Huaqiang <huaqiang.wang@intel.com>
Fri, 12 Oct 2018 10:24:54 +0000 (18:24 +0800)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 15 Oct 2018 15:03:23 +0000 (11:03 -0400)
The @alloc object returned by virDomainResctrlVcpuMatch is not
properly referenced and un-referenced in virDomainCachetuneDefParse.

This patch fixes this problem.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/conf/domain_conf.c

index 9911d56130a9ce219bbdd040d9b1c81ffb79a41d..e8e0adc8194e26823cf3ee46e7a84af1b068a462 100644 (file)
@@ -18833,7 +18833,7 @@ virDomainResctrlVcpuMatch(virDomainDefPtr def,
          * Just updating memory allocation information of that group
          */
         if (virBitmapEqual(def->resctrls[i]->vcpus, vcpus)) {
-            *alloc = def->resctrls[i]->alloc;
+            *alloc = virObjectRef(def->resctrls[i]->alloc);
             break;
         }
         if (virBitmapOverlaps(def->resctrls[i]->vcpus, vcpus)) {
@@ -19219,8 +19219,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
         if (!alloc)
             goto cleanup;
         new_alloc = true;
-    } else {
-        alloc = virObjectRef(alloc);
     }
 
     for (i = 0; i < n; i++) {