From c8ef88981b9ef4e791ea0e4c7fc7a0687ed3bc1c Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Sat, 26 Sep 2026 15:12:07 +0200 Subject: [PATCH] fixed memory leak in Atomics.store (#537) --- quickjs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); -- 2.47.3