run-test: Use g_autoptr/autofree

While we don't really care about freeing memory before leaving
main, it doesn't hurt and is good practice anyway.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3599>
This commit is contained in:
Florian Müllner 2025-01-16 15:02:24 +01:00 committed by Marge Bot
parent 696bd09d18
commit 68fe35d1a2

View File

@ -40,11 +40,11 @@ int
main (int argc, char **argv)
{
GOptionContext *context;
GError *error = NULL;
g_autoptr (GError) error = NULL;
ShellGlobal *global;
GjsContext *js_context;
const char *filename;
char *title;
g_autofree char *title = NULL;;
uint8_t code;
context = g_option_context_new (NULL);
@ -82,9 +82,6 @@ main (int argc, char **argv)
filename = argv[1];
title = g_filename_display_basename (filename);
g_set_prgname (title);
g_free (title);
error = NULL;
/* evaluate the script */
bool success = gjs_context_eval_module_file (js_context, filename, &code, &error);