Skip to content

Commit fb496c3

Browse files
authored
Fix Valgrind warning (#1161)
Initialize the JSPropertyDescriptor before calling JS_GetOwnProperty because the latter doesn't fill in the former if the property isn't found. Fixes: #1160
1 parent 844bb02 commit fb496c3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

quickjs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41499,6 +41499,11 @@ static JSValue js_iterator_concat_next(JSContext *ctx, JSValueConst this_val,
4149941499
// not done, construct { done: false, value: xxx } object
4150041500
// copy .value verbatim from source object, spec doesn't
4150141501
// allow dereferencing getters here
41502+
d = (JSPropertyDescriptor){
41503+
.value = JS_UNDEFINED,
41504+
.getter = JS_UNDEFINED,
41505+
.setter = JS_UNDEFINED,
41506+
};
4150241507
ret = JS_GetOwnProperty(ctx, &d, item, JS_ATOM_value);
4150341508
JS_FreeValue(ctx, item);
4150441509
if (ret < 0)

0 commit comments

Comments
 (0)