]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vbox: Don't leak arrays from XPCOM
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 16 Dec 2010 22:15:40 +0000 (23:15 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Fri, 17 Dec 2010 22:02:56 +0000 (23:02 +0100)
XPCOM returns an array as a pointer to an array of pointers to the
actual items. When the array isn't needed anymore the items are
released, but the actual array containing the pointers to the items
was not freed and leaked.

Free the actual array using ComUnallocMem.

This doesn't affect MSCOM as SafeArrayDestroy releases all items
and frees the array.

src/vbox/vbox_XPCOMCGlue.c

index 5992350104e87b712da65f05c68f7d0924f853d4..dcaf682eb346105c8af75c5ba32ef3539d625b65 100644 (file)
@@ -339,6 +339,8 @@ vboxArrayRelease(vboxArray *array)
         }
     }
 
+    pVBoxFuncs_v2_2->pfnComUnallocMem(array->items);
+
     array->items = NULL;
     array->count = 0;
 }
@@ -365,6 +367,8 @@ vboxArrayUnalloc(vboxArray *array)
         }
     }
 
+    pVBoxFuncs_v2_2->pfnComUnallocMem(array->items);
+
     array->items = NULL;
     array->count = 0;
 }