From 68fe35d1a2fdbec3612ccd66eb896dc51f511720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 16 Jan 2025 15:02:24 +0100 Subject: [PATCH] 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: --- src/run-js-test.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/run-js-test.c b/src/run-js-test.c index b58d41418..20b3c3aba 100644 --- a/src/run-js-test.c +++ b/src/run-js-test.c @@ -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);