1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

ECMAScript: Fix a leak in case of setTimeout(..., 0)

identified by Jonas seconds after I pushed the original fix out. *blush*
This commit is contained in:
Petr Baudis 2006-11-23 01:24:56 +01:00 committed by Petr Baudis
parent a0bc4f7792
commit eab3cb762f

View File

@ -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;
}