From 535288dc558616c4668a8522965a7833c2c3c356 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 26 Sep 2025 11:01:34 +0200 Subject: [PATCH] Fix Valgrind warning Initialize the JSPropertyDescriptor before calling JS_GetOwnProperty because the latter doesn't fill in the former if the property isn't found. Fixes: https://github.com/quickjs-ng/quickjs/issues/1160 --- quickjs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/quickjs.c b/quickjs.c index bd87b9625..f63b7df66 100644 --- a/quickjs.c +++ b/quickjs.c @@ -41499,6 +41499,11 @@ static JSValue js_iterator_concat_next(JSContext *ctx, JSValueConst this_val, // not done, construct { done: false, value: xxx } object // copy .value verbatim from source object, spec doesn't // allow dereferencing getters here + d = (JSPropertyDescriptor){ + .value = JS_UNDEFINED, + .getter = JS_UNDEFINED, + .setter = JS_UNDEFINED, + }; ret = JS_GetOwnProperty(ctx, &d, item, JS_ATOM_value); JS_FreeValue(ctx, item); if (ret < 0)