summaryrefslogtreecommitdiff
path: root/legacy/efreet
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2012-10-19 23:33:05 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2012-10-19 23:33:05 +0000
commit2a8b05eb03a61b6fd2365c77f93f42235c583aa2 (patch)
tree54033f73d671ea6486c989ae2c71071e44656573 /legacy/efreet
parent22cc05a9fe0df94a83f6cee175617e93632347e4 (diff)
efreet: Fix efreet_init_parse for non existent file
The conversion to eina_file_map() in r78179 broke the error path of efreet_init_parse(). Particularly if file doesn't exist. Since the variables were not initialized it was trying to operate on random values from the stack. So I got the following crash on E17: #0 0x00007f238b0bbd67 in waitpid () from /usr/lib/libpthread.so.0 #1 0x00000000004397a3 in e_alert_show () #2 0x0000000000526392 in e_sigseg_act () #3 <signal handler called> #4 0x0000000000000031 in ?? () #5 0x00007f239315df0f in efreet_ini_parse (file=file@entry=0x7fff39ce46f0 "/home/lucas/local/share/enlightenment/applications/defaults.list") at /home/lucas/p/e-svn/trunk/efreet/src/lib/efreet_ini.c:245 #6 0x00007f239315e100 in efreet_ini_new (file=0x7fff39ce46f0 "/home/lucas/local/share/enlightenment/applications/defaults.list") at /home/lucas/p/e-svn/trunk/efreet/src/lib/efreet_ini.c:82 #7 0x0000000000538174 in _e_util_default_terminal_get () #8 0x00000000005382dc in e_util_terminal_desktop_get () #9 0x00007f23706a1065 in e_fwin_init () from /home/lucas/local/lib/enlightenment/modules/fileman/linux-gnu-x86_64-ver-pre-svn-08/module.so #10 0x00007f237069b524 in e_modapi_init () from /home/lucas/local/lib/enlightenment/modules/fileman/linux-gnu-x86_64-ver-pre-svn-08/module.so #11 0x000000000050420d in e_module_enable () #12 0x0000000000504e77 in _e_module_cb_idler () #13 0x00007f238da22739 in _ecore_call_task_cb (data=<optimized out>, func=<optimized out>) at /home/lucas/p/e-svn/trunk/ecore/src/lib/ecore/ecore_private.h:265 #14 _ecore_idle_enterer_call () at /home/lucas/p/e-svn/trunk/ecore/src/lib/ecore/ecore_idle_enterer.c:234 #15 0x00007f238da24c1b in _ecore_main_loop_iterate_internal (once_only=once_only@entry=0) at /home/lucas/p/e-svn/trunk/ecore/src/lib/ecore/ecore_main.c:1826 #16 0x00007f238da252c7 in ecore_main_loop_begin () at /home/lucas/p/e-svn/trunk/ecore/src/lib/ecore/ecore_main.c:934 #17 0x0000000000436167 in main () Besides initializing the variables, there's no need to "goto" if the file doesn't exist.... just return. SVN revision: 78272
Diffstat (limited to 'legacy/efreet')
-rw-r--r--legacy/efreet/src/lib/efreet_ini.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/legacy/efreet/src/lib/efreet_ini.c b/legacy/efreet/src/lib/efreet_ini.c
index 3b92fbb709..422210fb04 100644
--- a/legacy/efreet/src/lib/efreet_ini.c
+++ b/legacy/efreet/src/lib/efreet_ini.c
@@ -94,13 +94,14 @@ efreet_ini_new(const char *file)
94static Eina_Hash * 94static Eina_Hash *
95efreet_ini_parse(const char *file) 95efreet_ini_parse(const char *file)
96{ 96{
97 Eina_File *f; 97 Eina_Hash *data = NULL, *section = NULL;
98 Eina_Iterator *it = NULL;
98 Eina_File_Line *line; 99 Eina_File_Line *line;
99 Eina_Hash *data, *section = NULL; 100 Eina_File *f;
100 Eina_Iterator *it;
101 101
102 f = eina_file_open(file, EINA_FALSE); 102 f = eina_file_open(file, EINA_FALSE);
103 if (!f) goto error; 103 if (!f)
104 return NULL;
104 105
105 data = eina_hash_string_small_new(EINA_FREE_CB(eina_hash_free)); 106 data = eina_hash_string_small_new(EINA_FREE_CB(eina_hash_free));
106 if (!data) goto error; 107 if (!data) goto error;
@@ -243,7 +244,8 @@ efreet_ini_parse(const char *file)
243error: 244error:
244 if (data) eina_hash_free(data); 245 if (data) eina_hash_free(data);
245 if (it) eina_iterator_free(it); 246 if (it) eina_iterator_free(it);
246 if (f) eina_file_close(f); 247
248 eina_file_close(f);
247 return NULL; 249 return NULL;
248} 250}
249 251