Last Comment Bug 410226 - leak in create_objects_from_handles
: leak in create_objects_from_handles
Status: RESOLVED FIXED
: mlk
Product: NSS
Classification: Components
Component: Libraries (show other bugs)
: 3.2
: All All
: P3 minor (vote)
: 3.12
Assigned To: Julien Pierre
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-12-29 22:43 PST by Nelson Bolyard (seldom reads bugmail)
Modified: 2008-02-04 19:22 PST (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Fix leak (526 bytes, patch)
2008-02-04 19:07 PST, Julien Pierre
nelson: review+
Details | Diff | Splinter Review

Description Nelson Bolyard (seldom reads bugmail) 2007-12-29 22:43:39 PST
Function create_objects_from_handles allocates an array of pointers
whose address is kept in the variable "objects".  Then after that array 
is allocated, it tries to fill in the array with values of other allocated
objects.  If any of the allocation attempts fails, it frees all the previously
allocated objects, but does not free the array of object pointers.  It leaks
the array named "objects".
Comment 1 Julien Pierre 2008-02-04 19:07:41 PST
Created attachment 301437 [details] [diff] [review]
Fix leak
Comment 2 Nelson Bolyard (seldom reads bugmail) 2008-02-04 19:19:17 PST
Comment on attachment 301437 [details] [diff] [review]
Fix leak

I guess this is the right free routine for "objects".  Not sure.
Comment 3 Julien Pierre 2008-02-04 19:22:50 PST
Nelson,

Thanks for the review. It is the right routine. You can find examples in the same source file of other objectHandles arrays allocated with nss_ZNEWARRAY and freed with nss_ZFreeIf.

I checked this in to the trunk.

Checking in devtoken.c;
/cvsroot/mozilla/security/nss/lib/dev/devtoken.c,v  <--  devtoken.c
new revision: 1.43; previous revision: 1.42
done

Note You need to log in before you can comment on or make changes to this bug.