From: Matthias Bolte Date: Thu, 16 Dec 2010 22:15:40 +0000 (+0100) Subject: vbox: Don't leak arrays from XPCOM X-Git-Tag: v0.8.7~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c572b6c785ebc471584f2b40b480691c89dd3dc;p=thirdparty%2Flibvirt.git vbox: Don't leak arrays from XPCOM 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. --- diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c index 5992350104..dcaf682eb3 100644 --- a/src/vbox/vbox_XPCOMCGlue.c +++ b/src/vbox/vbox_XPCOMCGlue.c @@ -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; }