Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quickjs_backend: Fixes to ensure JS_FreeValue() is properly called #4190

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/quickjs_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,7 @@ static JSValue callFunction(JSContext *ctx, const std::string &function, std::ve
// UNBOX_SCRIPT_ASSERT(context, type != SCRIPT_POSITION, "Cannot assign a trigger to a position");
ASSERT(false, "Not currently handling triggered property - does anything use this?");
}
JS_FreeValue(ctx, triggered);

if (type == SCRIPT_RADIUS)
{
Expand Down Expand Up @@ -2482,8 +2483,8 @@ static JSValue js_setTimer(JSContext *ctx, JSValueConst this_val, int argc, JSVa
int player = QuickJS_GetInt32(ctx, global_obj, "me");

JSValue funcObj = JS_GetPropertyStr(ctx, global_obj, functionName.c_str()); // check existence
auto free_func_obj = gsl::finally([ctx, funcObj] { JS_FreeValue(ctx, funcObj); }); // establish exit action
SCRIPT_ASSERT(ctx, JS_IsFunction(ctx, funcObj), "No such function: %s", functionName.c_str());
JS_FreeValue(ctx, funcObj);

std::string stringArg;
BASE_OBJECT *psObj = nullptr;
Expand Down Expand Up @@ -2561,8 +2562,8 @@ static JSValue js_queue(JSContext *ctx, JSValueConst this_val, int argc, JSValue
auto free_global_obj = gsl::finally([ctx, global_obj] { JS_FreeValue(ctx, global_obj); }); // establish exit action

JSValue funcObj = JS_GetPropertyStr(ctx, global_obj, functionName.c_str()); // check existence
auto free_func_obj = gsl::finally([ctx, funcObj] { JS_FreeValue(ctx, funcObj); }); // establish exit action
SCRIPT_ASSERT(ctx, JS_IsFunction(ctx, funcObj), "No such function: %s", functionName.c_str());
JS_FreeValue(ctx, funcObj);

int32_t ms = 0;
if (argc > 1)
Expand Down
Loading