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 | 263d4ed2cd01e1b5cc6b1e36d7693a0f510fb190 (patch) | |
tree | 056562b327f0f695928f15e1ce82b8103d4c735b /navit/start.c | |
parent | 519eca5c34668e751bef69ad29871c91cf7be003 (diff) | |
download | navit-263d4ed2cd01e1b5cc6b1e36d7693a0f510fb190.tar.gz |
Fix:Core:Avoid unneccessary double calling of file_exist with freed memory
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2137 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/start.c')
-rw-r--r-- | navit/start.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/navit/start.c b/navit/start.c index 275dbae65..d877af925 100644 --- a/navit/start.c +++ b/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); |