commit b37fc8e0156966b0a4c5b4a4f2fcfcad7d7d9dde
parent 92135366e5abc9d2bffd049576fc3fd4f960208e
Author: Dmitry Volyntsev <xeioexception@gmail.com>
Date: Sun, 14 Jul 2024 15:08:40 -0700
Fix GC leak in `js_proxy_get()` (#302)
Fixes #277
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/quickjs/quickjs.c b/quickjs/quickjs.c
@@ -46369,8 +46369,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)) {