Closed Bug 619794 Opened 9 years ago Closed 9 years ago

DECOMPILE_CODE leaks xval on failure in Decompile

Categories

(Core :: JavaScript Engine, defect)

x86
Windows 7
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity, memory-leak, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

1825 Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)

1870 #define DECOMPILE_CODE(pc,nb) if (!Decompile(ss, pc, nb, JSOP_NOP)) return NULL

3325                   case SRC_COND:
3326                     xval = JS_strdup(cx, POP_STR());
3327                     if (!xval)
3328                         return NULL;
3329                     len = js_GetSrcNoteOffset(sn, 0);
this leaks xval:
3330                     DECOMPILE_CODE(pc + oplen, len - oplen);
3331                     lval = JS_strdup(cx, POP_STR());
3332                     if (!lval) {
3333                         cx->free((void *)xval);
3334                         return NULL;
3335                     }
3336                     pc += len;

3337                     LOCAL_ASSERT(*pc == JSOP_GOTO || *pc == JSOP_GOTOX);
3338                     oplen = js_CodeSpec[*pc].length;
3339                     len = GetJumpOffset(pc, pc);
this leaks xval:
3340                     DECOMPILE_CODE(pc + oplen, len - oplen);
3341                     rval = POP_STR();
3342                     todo = Sprint(&ss->sprinter, "%s ? %s : %s",
3343                                   xval, lval, rval);
3344                     cx->free((void *)xval);
3345                     cx->free((void *)lval);
3346                     break;
3347
oh, the second one probably also leaks lval...
Attached patch proposalSplinter Review
Assignee: general → timeless
Status: NEW → ASSIGNED
Attachment #498301 - Flags: review?(jorendorff)
Comment on attachment 498301 [details] [diff] [review]
proposal

Review of attachment 498301 [details] [diff] [review]:

r=me
Attachment #498301 - Flags: review?(jorendorff) → review+
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/0bc724be8daf
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.