Last Comment Bug 410226 - leak in create_objects_from_handles
: leak in create_objects_from_handles
: mlk
Product: NSS
Classification: Components
Component: Libraries (show other bugs)
: 3.2
: All All
P3 minor (vote)
: 3.12
Assigned To: Julien Pierre
Depends on:
  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:
QA Whiteboard:
Iteration: ---
Points: ---

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

Description User image 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 User image Julien Pierre 2008-02-04 19:07:41 PST
Created attachment 301437 [details] [diff] [review]
Fix leak
Comment 2 User image 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 User image Julien Pierre 2008-02-04 19:22:50 PST

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

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