From: Wang Huaqiang Date: Fri, 12 Oct 2018 10:24:54 +0000 (+0800) Subject: conf: Fix bug in finding alloc through matching vcpus X-Git-Tag: v4.9.0-rc1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a1cdb06fd9bc5e35230f6198e697d6ec03d1206;p=thirdparty%2Flibvirt.git 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 Reviewed-by: John Ferlan --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9911d56130..e8e0adc819 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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++) {