diff options
author | Wen Congyang <wency@cn.fujitsu.com> | 2011-06-28 11:41:15 +0800 |
---|---|---|
committer | Wen Congyang <wency@cn.fujitsu.com> | 2011-06-30 13:26:51 +0800 |
commit | 53d03ba837fb32ae09f6b1cecd11f03ad97ef8f2 (patch) | |
tree | 816f3518f954b2092cef6f0be60216963c086cea | |
parent | build: avoid pod2man on tarball (diff) | |
download | libvirt-53d03ba837fb32ae09f6b1cecd11f03ad97ef8f2.tar.gz libvirt-53d03ba837fb32ae09f6b1cecd11f03ad97ef8f2.tar.bz2 libvirt-53d03ba837fb32ae09f6b1cecd11f03ad97ef8f2.zip |
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.
-rw-r--r-- | src/conf/domain_conf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 60e0318a4..f9bf51e3c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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(); |