From: Fabrice Bellard Date: Sat, 26 Sep 2026 13:12:07 +0000 (+0200) Subject: fixed memory leak in Atomics.store (#537) X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=c8ef88981b9ef4e791ea0e4c7fc7a0687ed3bc1c;p=quickjs.git fixed memory leak in Atomics.store (#537) --- diff --git a/quickjs.c b/quickjs.c index adfed75..48eeb2b 100644 --- a/quickjs.c +++ b/quickjs.c @@ -60804,10 +60804,14 @@ static JSValue js_atomics_store(JSContext *ctx, } v = v32; } - if (typed_array_is_oob(p)) + if (typed_array_is_oob(p)) { + JS_FreeValue(ctx, ret); return JS_ThrowTypeErrorDetachedArrayBuffer(ctx); - if (idx >= p->u.array.count) + } + if (idx >= p->u.array.count) { + JS_FreeValue(ctx, ret); return JS_ThrowRangeError(ctx, "out-of-bound access"); + } ptr = p->u.array.u.uint8_ptr + ((uintptr_t)idx << size_log2);