Last Comment Bug 651973 - RegExp not released on error path in createObjectNoStatics
: RegExp not released on error path in createObjectNoStatics
Status: RESOLVED FIXED
fixed-in-tracemonkey
: mlk
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Michael Wu [:mwu]
:
Mentors:
Depends on:
Blocks:
  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:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


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

Description Michael Wu [:mwu] 2011-04-21 14:27:31 PDT
Created attachment 527648 [details] [diff] [review]
Release RegExp on error
Comment 1 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 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 Michael Wu [:mwu] 2011-04-25 13:29:14 PDT
http://hg.mozilla.org/tracemonkey/rev/152ef9c8b2bb

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

It looks sorta nice on two lines IMO anyway..
Comment 4 Michael Wu [:mwu] 2011-04-26 12:23:10 PDT
http://hg.mozilla.org/mozilla-central/rev/152ef9c8b2bb

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