diff --git a/internal/fd.c b/internal/fd.c index d9f7eab7..43be0c86 100644 --- a/internal/fd.c +++ b/internal/fd.c @@ -636,7 +636,8 @@ static void visit_directory(JSContext *js, JSValue *results, int *result_count, } else { strcpy(item_rel, ffd.cFileName); } - JS_SetPropertyNumber(js, *results, (*result_count)++, JS_NewString(js, item_rel)); + JSValue name_str = JS_NewString(js, item_rel); + JS_SetPropertyNumber(js, *results, (*result_count)++, name_str); if (recurse) { struct stat st; @@ -661,7 +662,8 @@ static void visit_directory(JSContext *js, JSValue *results, int *result_count, } else { strcpy(item_rel, dir->d_name); } - JS_SetPropertyNumber(js, *results, (*result_count)++, JS_NewString(js, item_rel)); + JSValue name_str = JS_NewString(js, item_rel); + JS_SetPropertyNumber(js, *results, (*result_count)++, name_str); if (recurse) { struct stat st; diff --git a/source/qjs_actor.c b/source/qjs_actor.c index c4c18ff5..e81bd79e 100644 --- a/source/qjs_actor.c +++ b/source/qjs_actor.c @@ -133,7 +133,8 @@ static void js_log_callback(JSContext *ctx, const char *channel, const char *msg JS_FRAME(ctx); JS_ROOT(stack, JS_GetStack(ctx)); JS_ROOT(args_array, JS_NewArray(ctx)); - JS_SetPropertyNumber(ctx, args_array.val, 0, JS_NewString(ctx, msg)); + JSValue msg_str = JS_NewString(ctx, msg); + JS_SetPropertyNumber(ctx, args_array.val, 0, msg_str); JS_SetPropertyNumber(ctx, args_array.val, 1, stack.val); JSValue argv[2]; argv[0] = JS_NewString(ctx, channel);