Closed Bug 617964 Opened 13 years ago Closed 10 years ago

jsd_NewValue leaks jsdval when JS_EnterCrossCompartmentCall fails

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

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

Attachments

(1 file)

558 bytes, patch
jorendorff
: review+
Details | Diff | Splinter Review
283 jsd_NewValue(JSDContext* jsdc, jsval val)
284 {
285     JSDValue* jsdval;
286     JSCrossCompartmentCall *call = NULL;
287 
alloc site:
288     if(!(jsdval = (JSDValue*) calloc(1, sizeof(JSDValue))))
289         return NULL;

296         call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, jsdc->glob);
297         if(!call) {
298             JS_EndRequest(jsdc->dumbContext);

leak site: (thank you mrbkap, gal)
299 
300             return NULL;
301         }

303         ok = JS_AddNamedValueRoot(jsdc->dumbContext, &jsdval->val, "JSDValue");
304         JS_LeaveCrossCompartmentCall(call);
305         JS_EndRequest(jsdc->dumbContext);
306         if(!ok)
307         {
does not leak site: (please follow when in rome!)
308             free(jsdval);
309             return NULL;
Attached patch patchSplinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #496596 - Flags: review?(jorendorff)
Attachment #496596 - Flags: review?(jorendorff) → review+
Component: JavaScript Debugging/Profiling APIs → JavaScript Engine
The patch landed, and the bug is fixed. Closing.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0
You need to log in before you can comment on or make changes to this bug.