conf: Fix bug in finding alloc through matching vcpus

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>
This commit is contained in:
Wang Huaqiang 2018-10-12 18:24:54 +08:00 committed by John Ferlan
parent 4c64768e8f
commit 3a1cdb06fd
1 changed files with 1 additions and 3 deletions

View File

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