From: Fabrice Bellard Date: Sat, 21 Nov 2026 13:49:09 +0000 (+0100) Subject: Drop the new prototype's reference when the shape cannot be made writable X-Git-Url: https://git.kaiwu.me/http/ngx_http_proxy_module.html?a=commitdiff_plain;h=b833931b9c4feab9c26f8e7b7245d55ffdb28911;p=quickjs.git Drop the new prototype's reference when the shape cannot be made writable --- diff --git a/quickjs.c b/quickjs.c index fabeac6..feec990 100644 --- a/quickjs.c +++ b/quickjs.c @@ -8112,8 +8112,11 @@ static int JS_SetPrototypeInternal(JSContext *ctx, JSValueConst obj, JS_DupValue(ctx, proto_val); } - if (js_shape_prepare_update(ctx, p, NULL)) + if (js_shape_prepare_update(ctx, p, NULL)) { + if (proto) + JS_FreeValue(ctx, JS_MKPTR(JS_TAG_OBJECT, proto)); return -1; + } sh = p->shape; if (sh->proto) JS_FreeValue(ctx, JS_MKPTR(JS_TAG_OBJECT, sh->proto));