[epiphany] EphyProfileUtils: fix leak in ephy_profile_utils_do_migration



commit 08d54ae133ac5f7bdd96c72d16287fdd2cb89bc0
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Sep 3 18:16:54 2015 -0500

    EphyProfileUtils: fix leak in ephy_profile_utils_do_migration
    
    The first parameter to g_environ_setenv is "transfer full" but so is the
    return value, and it is used as the return value.
    
    Indirect leak of 5579 byte(s) in 82 object(s) allocated from:
        #0 0x7f1d6e115a0a in malloc (/lib64/libasan.so.2+0x98a0a)
        #1 0x7f1d582b33c4 in g_malloc
    /home/mcatanzaro/jhbuild/checkout/glib/glib/gmem.c:94
        #2 0x7f1d582cb1ac in g_strdup
    /home/mcatanzaro/jhbuild/checkout/glib/glib/gstrfuncs.c:363
        #3 0x7f1d582cca45 in g_strdupv
    /home/mcatanzaro/jhbuild/checkout/glib/glib/gstrfuncs.c:2491
        #4 0x7f1d582997e1 in g_get_environ
    /home/mcatanzaro/jhbuild/checkout/glib/glib/genviron.c:413
        #5 0x4ee3cc in ephy_profile_utils_do_migration
    /home/mcatanzaro/jhbuild/checkout/epiphany/lib/ephy-profile-utils.c:102
        #6 0x42437c in main
    /home/mcatanzaro/jhbuild/checkout/epiphany/src/ephy-main.c:378
        #7 0x7f1d574196ff in __libc_start_main (/lib64/libc.so.6+0x206ff)

 lib/ephy-profile-utils.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/lib/ephy-profile-utils.c b/lib/ephy-profile-utils.c
index 78ced32..0430582 100644
--- a/lib/ephy-profile-utils.c
+++ b/lib/ephy-profile-utils.c
@@ -108,8 +108,10 @@ ephy_profile_utils_do_migration (const char *profile_directory, int test_to_run,
   /* If we're not trying to run a migration step in a test and there
      is nothing to migrate, don't spawn the migrator at all. */
   if (test_to_run == -1 &&
-      EPHY_PROFILE_MIGRATION_VERSION == ephy_profile_utils_get_migration_version ())
+      EPHY_PROFILE_MIGRATION_VERSION == ephy_profile_utils_get_migration_version ()) {
+    g_strfreev (envp);
     return TRUE;
+  }
 
   if (test_to_run != -1) {
     index = g_strdup_printf ("%d", test_to_run);


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