[glib: 1/4] tests: Fix some minor memory leaks in gsubprocess-testprog



commit 90ca3b4dd04a63be4e963d52021de20cd2219cc0
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Oct 8 13:13:22 2018 +1300

    tests: Fix some minor memory leaks in gsubprocess-testprog
    
    This just makes the valgrind logs a bit cleaner so we can find real
    problems in future.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 gio/tests/gsubprocess-testprog.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gio/tests/gsubprocess-testprog.c b/gio/tests/gsubprocess-testprog.c
index 74cb9e2a3..c9b06c2a2 100644
--- a/gio/tests/gsubprocess-testprog.c
+++ b/gio/tests/gsubprocess-testprog.c
@@ -200,12 +200,17 @@ main (int argc, char **argv)
   GOptionContext *context;
   GError *error = NULL;
   const char *mode;
+  gboolean ret;
 
   context = g_option_context_new ("MODE - Test GSubprocess stuff");
   g_option_context_add_main_entries (context, options, NULL);
-  if (!g_option_context_parse (context, &argc, &argv, &error))
+  ret = g_option_context_parse (context, &argc, &argv, &error);
+  g_option_context_free (context);
+
+  if (!ret)
     {
       g_printerr ("%s: %s\n", argv[0], error->message);
+      g_error_free (error);
       return 1;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]