Last Comment Bug 651973 - RegExp not released on error path in createObjectNoStatics
: RegExp not released on error path in createObjectNoStatics
: mlk
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
-- normal (vote)
: ---
Assigned To: Michael Wu [:mwu]
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2011-04-21 14:27 PDT by Michael Wu [:mwu]
Modified: 2011-04-26 12:23 PDT (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Release RegExp on error (475 bytes, patch)
2011-04-21 14:27 PDT, Michael Wu [:mwu]
cdleary: review+
Details | Diff | Splinter Review

Description User image Michael Wu [:mwu] 2011-04-21 14:27:31 PDT
Created attachment 527648 [details] [diff] [review]
Release RegExp on error
Comment 1 User image Chris Leary [:cdleary] (not checking bugmail) 2011-04-21 22:12:20 PDT
Comment on attachment 527648 [details] [diff] [review]
Release RegExp on error

Nice catch! Only nit is that I think SpiderMonkey style prefers combining with the above test a la:

    if (!obj ||
        !obj->initRegExp(cx, re.get())) {
        // common cleanup code
Comment 2 User image Jeff Walden [:Waldo] (remove +bmo to email) 2011-04-22 12:56:02 PDT
...except combine the two conditions to one line, like:

if (!obj || !obj->initRegExp(cx, re.get()))

because it all fits on one line, in 99ish characters.
Comment 3 User image Michael Wu [:mwu] 2011-04-25 13:29:14 PDT

Hm I forgot to make it one line.. sorry about that!

It looks sorta nice on two lines IMO anyway..
Comment 4 User image Michael Wu [:mwu] 2011-04-26 12:23:10 PDT

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