Bug 617964 jsd_NewValue leaks jsdval when JS_EnterCrossCompartmentCall fails, r=jorendorff
authortimeless@mozdev.org
Thu, 09 Dec 2010 13:14:00 -0800
changeset 59929 ca462888d2b210b5024decbb7e1627f9faafff04
parent 59928 faba5ec16e4f0ef12d31047b7b27767fc60f5c6f
child 59930 5641d5c42b7c5b97b984d4aece75d1766fd510d0
push idunknown
push userunknown
push dateunknown
reviewersjorendorff
bugs617964
milestone2.0b8pre
Bug 617964 jsd_NewValue leaks jsdval when JS_EnterCrossCompartmentCall fails, r=jorendorff
js/jsd/jsd_val.c
--- a/js/jsd/jsd_val.c
+++ b/js/jsd/jsd_val.c
@@ -293,17 +293,17 @@ jsd_NewValue(JSDContext* jsdc, jsval val
     if(JSVAL_IS_GCTHING(val))
     {
         JSBool ok = JS_FALSE;
         JS_BeginRequest(jsdc->dumbContext);
 
         call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, jsdc->glob);
         if(!call) {
             JS_EndRequest(jsdc->dumbContext);
-
+            free(jsdval);
             return NULL;
         }
 
         ok = JS_AddNamedValueRoot(jsdc->dumbContext, &jsdval->val, "JSDValue");
         JS_LeaveCrossCompartmentCall(call);
         JS_EndRequest(jsdc->dumbContext);
         if(!ok)
         {