]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Fix memory leak in virDomainVcpuPinDel()
authorWen Congyang <wency@cn.fujitsu.com>
Tue, 28 Jun 2011 03:41:15 +0000 (11:41 +0800)
committerWen Congyang <wency@cn.fujitsu.com>
Thu, 30 Jun 2011 05:26:51 +0000 (13:26 +0800)
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.

src/conf/domain_conf.c

index 60e0318a41de50242c7be16784d565c875bdf94c..f9bf51e3c7210443afdb34fd03650f4bf2f16b76 100644 (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();