From: Dmitry Volyntsev Date: Sun, 14 Jul 2024 22:08:40 +0000 (-0700) Subject: Fix GC leak in `js_proxy_get()` (#302) X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=b3715f7cb1f7e7e99fa5e768e3af3f6bb22ae50f;p=quickjs.git Fix GC leak in `js_proxy_get()` (#302) Fixes #277 --- diff --git a/quickjs.c b/quickjs.c index f000ff7..268bc84 100644 --- a/quickjs.c +++ b/quickjs.c @@ -46151,8 +46151,10 @@ static JSValue js_proxy_get(JSContext *ctx, JSValueConst obj, JSAtom atom, if (JS_IsException(ret)) return JS_EXCEPTION; res = JS_GetOwnPropertyInternal(ctx, &desc, JS_VALUE_GET_OBJ(s->target), atom); - if (res < 0) + if (res < 0) { + JS_FreeValue(ctx, ret); return JS_EXCEPTION; + } if (res) { if ((desc.flags & (JS_PROP_GETSET | JS_PROP_CONFIGURABLE | JS_PROP_WRITABLE)) == 0) { if (!js_same_value(ctx, desc.value, ret)) {