Fix memory leak in virDomainVcpuPinDel()

virDomainVcpuPinDefFree() does not free def->cputune.vcpupin if nvcpupin
is 0, and does not set def->cputune.vcpupin to NULL.

If we set nvcpupin to 0 but do not free vcpupin, vcpupin will not be freed
when vm->def is freed.

Use VIR_FREE() instead of virDomainVcpuPinDefFree() to free the memory
and set def->cputune.vcpupint to NULL.
This commit is contained in:
Wen Congyang 2011-06-28 11:41:15 +08:00
parent f1fea71df5
commit 53d03ba837

View File

@ -8263,7 +8263,7 @@ virDomainVcpuPinDel(virDomainDefPtr def, int vcpu)
return 0;
if (--def->cputune.nvcpupin == 0) {
virDomainVcpuPinDefFree(def->cputune.vcpupin, 0);
VIR_FREE(def->cputune.vcpupin);
} else {
if (VIR_REALLOC_N(def->cputune.vcpupin, def->cputune.nvcpupin) < 0) {
virReportOOMError();