shithub: libmujs

Download patch

ref: e8dad5a39e2622074659ef68f02ecf2f9f2451bd
parent: 0a3fc1260101b79de8f088e86fe78bfb553d0290
author: Sebastian Rasmussen <sebras@gmail.com>
date: Tue Jul 4 22:45:15 EDT 2017

Make js_freestate() not segfault on NULL argument.

--- a/jsgc.c
+++ b/jsgc.c
@@ -225,6 +225,9 @@
 	js_Environment *env, *nextenv;
 	js_String *str, *nextstr;
 
+	if (!J)
+		return;
+
 	for (env = J->gcenv; env; env = nextenv)
 		nextenv = env->gcnext, jsG_freeenvironment(J, env);
 	for (fun = J->gcfun; fun; fun = nextfun)