From eab3cb762f4742ffceec9915841469ddd64e1d18 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 23 Nov 2006 01:24:56 +0100 Subject: [PATCH] ECMAScript: Fix a leak in case of setTimeout(..., 0) identified by Jonas seconds after I pushed the original fix out. *blush* --- src/ecmascript/spidermonkey/window.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index c720f8402..3cf4382b9 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -411,8 +411,10 @@ window_setTimeout(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval if (!code) return JS_TRUE; timeout = atoi(jsval_to_string(ctx, &argv[1])); - if (timeout <= 0) + if (timeout <= 0) { + mem_free(code); return JS_TRUE; + } ecmascript_set_timeout(interpreter, code, timeout); return JS_TRUE; }