[vbox-dev] Bug report (major, ressource leak)
Frank Mehnert
Frank.Mehnert at Sun.COM
Sat May 1 00:05:44 PDT 2010
On Saturday 01 May 2010, TwoThe wrote:
> Type: Bug
> Severity: major, ressource leak
> Component: VirtualBox OSE
> Host: Ubuntu 64
>
> In file vbox/src/libs/xpcom18a4/nsprpub/pr/src/threads/prcmon.c:
>
> #136 p = (MonitorCacheEntry*)
> 137 PR_REALLOC(new_entries, added *
> sizeof(MonitorCacheEntry)); 138 if (p == 0) {
> 139 /*
> 140 ** Total lossage. We just leaked a bunch of system
> monitors 141 ** all over the floor. This should never ever
> happen. 142 */
> 143 PR_ASSERT(p != 0);
> 144 return PR_FAILURE;
> 145 }
> 146 }
> 147
> 148 /*
> 149 ** Now that we have allocated all of the system monitors, build
> up 150 ** the new free list. We can just update the free_list because we
> own 151 ** the mcache-lock and we aren't calling anyone who might want
> to use 152 ** it.
> 153 */
> !154 for (i = 0, p = new_entries; i < added - 1; i++, p++)
>
> In line 136 memory is allocated and assigned to p. In line 154 the value of
> p is overwritten and the memory pointed to before is never freed.
Thank you for this report!
Your observation is correct and we will fix the code. However, this
path shouldn't be used in real life because if PR_CALLOC we will
probably loose at other places too.
Kind regards,
Frank
--
Dr.-Ing. Frank Mehnert
Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Jürgen Kunz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.virtualbox.org/pipermail/vbox-dev/attachments/20100501/14ce5546/attachment-0001.bin
More information about the vbox-dev
mailing list