[PATCH 5/6] vbox: Don't leak arrays from XPCOM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index 5992350..dcaf682 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;
 }
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]