main: Free g_key_file config immediately after use
[platform/upstream/connman.git] / src / main.c
index e539e6d..354734d 100644 (file)
@@ -400,8 +400,10 @@ int main(int argc, char *argv[])
        __connman_dbus_init(conn);
 
        config = load_config(CONFIGDIR "/main.conf");
-
-       parse_config(config);
+       if (config != NULL) {
+               parse_config(config);
+               g_key_file_free(config);
+       }
 
        __connman_storage_migrate();
        __connman_technology_init();
@@ -491,9 +493,6 @@ int main(int argc, char *argv[])
 
        g_main_loop_unref(main_loop);
 
-       if (config)
-               g_key_file_free(config);
-
        if (connman_settings.pref_timeservers != NULL)
                g_strfreev(connman_settings.pref_timeservers);