daemon: fixed memory leak in gsignond-config.c
authorImran Zaman <imran.zaman@linux.intel.com>
Mon, 29 Apr 2013 09:06:13 +0000 (12:06 +0300)
committerImran Zaman <imran.zaman@linux.intel.com>
Mon, 29 Apr 2013 09:06:13 +0000 (12:06 +0300)
src/common/gsignond-config.c

index 2cb754f..d77d9ed 100644 (file)
@@ -178,9 +178,9 @@ gsignond_config_load (GSignondConfig *self)
         if (g_access (def_config, R_OK) == 0) {
             self->priv->config_file_path = def_config;
         } else {
+            g_free (def_config);
             sysconfdirs = g_get_system_config_dirs ();
             while (*sysconfdirs != NULL) {
-                g_free (def_config);
                 def_config = g_build_filename (*sysconfdirs,
                                                "gsignond/gsignond.conf",
                                                NULL);
@@ -188,6 +188,7 @@ gsignond_config_load (GSignondConfig *self)
                     self->priv->config_file_path = def_config;
                     break;
                 }
+                g_free (def_config);
                 sysconfdirs++;
             }
         }