diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2009-03-17 10:49:35 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2009-03-17 10:49:35 +0000 |
commit | b9dc78c425ace54b1edbaf104c067497ee47294a (patch) | |
tree | adff2b579249bcc9f8ca1d8612b5c10f731c537e | |
parent | f1630760ec7f37e7ee55c006b4fb7e2e2cc84e2b (diff) | |
download | navit-b9dc78c425ace54b1edbaf104c067497ee47294a.tar.gz |
Fix:Core:Avoid unneccessary double calling of file_exist with freed memory
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@2137 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r-- | navit/navit/start.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/navit/navit/start.c b/navit/navit/start.c index 275dbae65..d877af925 100644 --- a/navit/navit/start.c +++ b/navit/navit/start.c @@ -151,7 +151,7 @@ int main(int argc, char **argv) #endif } li = list; - do { + for (;;) { if (li == NULL) { // We have not found an existing config file from all possibilities printf(_("No config file navit.xml, navit.xml.local found\n")); @@ -159,16 +159,23 @@ int main(int argc, char **argv) } // Try the next config file possibility from the list config_file = li->data; - if (!file_exists(config_file)) g_free(config_file); + if (file_exists(config_file)) + break; + else + g_free(config_file); li = g_list_next(li); - } while (!file_exists(config_file)); - g_list_free(list); + } if (!config_load(config_file, &error)) { dbg(0, _("Error parsing '%s': %s\n"), config_file, error ? error->message : ""); } else { dbg(0, _("Using '%s'\n"), config_file); } + while (li) { + g_free(li->data); + li = g_list_next(li); + } + g_list_free(list); if (! main_get_navit(NULL)) { dbg(0, _("No instance has been created, exiting\n")); exit(1); |