Skip to content

Commit ab19fef

Browse files
committed
Fixed console.timeEnd() memleak.
1 parent a62eed8 commit ab19fef

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

nginx/ngx_js.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,10 @@ ngx_qjs_ext_console_time_end(JSContext *cx, JSValueConst this_val, int argc,
19381938
ngx_log_error(NGX_LOG_INFO, c->log, 0, "js: %V: %uL.%06uLms",
19391939
&name, ms, ns);
19401940

1941+
if (name.data != default_label.data) {
1942+
JS_FreeCString(cx, (char *) name.data);
1943+
}
1944+
19411945
return JS_UNDEFINED;
19421946

19431947
not_found:
@@ -1946,6 +1950,10 @@ ngx_qjs_ext_console_time_end(JSContext *cx, JSValueConst this_val, int argc,
19461950
ngx_log_error(NGX_LOG_INFO, c->log, 0, "js: Timer \"%V\" doesn't exist",
19471951
&name);
19481952

1953+
if (name.data != default_label.data) {
1954+
JS_FreeCString(cx, (char *) name.data);
1955+
}
1956+
19491957
return JS_UNDEFINED;
19501958
}
19511959

0 commit comments

Comments
 (0)