[gjs: 4/9] engine: delete context if hosted code can't be defined



commit 57e72b9b6e11aca3e8228ff7319cf99651fb7b78
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Sat Oct 13 16:39:11 2018 -0500

    engine: delete context if hosted code can't be defined

 gjs/engine.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gjs/engine.cpp b/gjs/engine.cpp
index 4f50e417..6cfccc4b 100644
--- a/gjs/engine.cpp
+++ b/gjs/engine.cpp
@@ -306,8 +306,10 @@ gjs_create_js_context(GjsContext *js_context)
     if (!cx)
         return nullptr;
 
-    if (!JS::InitSelfHostedCode(cx))
+    if (!JS::InitSelfHostedCode(cx)) {
+        JS_DestroyContext(cx);
         return nullptr;
+    }
 
     // commented are defaults in moz-24
     JS_SetNativeStackQuota(cx, 1024 * 1024);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]