[file-roller] Fix fr_application_local_command_line memory leak



commit 1139c1a6bc1707fdb64e8baa824d19b83c4ff835
Author: David King <dking redhat com>
Date:   Thu Jul 16 10:43:14 2015 +0100

    Fix fr_application_local_command_line memory leak
    
    Found with Valgrind:
    
    ==9376== 57 bytes in 2 blocks are definitely lost in loss record 10,632
    of 17,91
    6
    ==9376==    at 0x4C2BC50: malloc (in
    /usr/lib64/valgrind/vgpreload_memcheck-amd6
    4-linux.so)
    ==9376==    by 0x748B689: g_malloc (gmem.c:97)
    ==9376==    by 0x74A425E: g_strdup (gstrfuncs.c:356)
    ==9376==    by 0x74A5B74: g_strdupv (gstrfuncs.c:2467)
    ==9376==    by 0x41C04D: fr_application_local_command_line
    (fr-application.c:649)
    ==9376==    by 0x6F0F529: g_application_run (gapplication.c:2280)
    ==9376==    by 0x414FE5: main (main.c:38)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752476

 src/fr-application.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/src/fr-application.c b/src/fr-application.c
index 06d86a1..92e2fc9 100644
--- a/src/fr-application.c
+++ b/src/fr-application.c
@@ -641,21 +641,19 @@ fr_application_local_command_line (GApplication   *application,
                                    char         ***arguments,
                                    int            *exit_status)
 {
-        char           **local_argv;
         int              local_argc;
         GOptionContext  *context;
         GError          *error = NULL;
         gboolean         handled_locally = FALSE;
 
-        local_argv = g_strdupv (*arguments);
-        local_argc = g_strv_length (local_argv);
+        local_argc = g_strv_length (*arguments);
 
-        program_argv0 = local_argv[0];
+        program_argv0 = *arguments[0];
         *exit_status = 0;
 
         context = fr_application_create_option_context ();
         g_option_context_set_ignore_unknown_options (context, TRUE);
-       if (! g_option_context_parse (context, &local_argc, &local_argv, &error)) {
+       if (! g_option_context_parse (context, &local_argc, arguments, &error)) {
                *exit_status = EXIT_FAILURE;
                g_critical ("Failed to parse arguments: %s", error->message);
                 g_clear_error (&error);
@@ -668,7 +666,6 @@ fr_application_local_command_line (GApplication   *application,
        }
 
        g_option_context_free (context);
-        g_strfreev (local_argv);
 
         return handled_locally;
 }


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