Efreet: Fail on invalid ini file

SVN revision: 58605
This commit is contained in:
Sebastian Dransfeld 2011-04-12 22:42:15 +00:00
parent 649229a695
commit 4262dd6285
1 changed files with 12 additions and 8 deletions

View File

@ -196,15 +196,15 @@ efreet_ini_parse(const char *file)
if (!section) if (!section)
{ {
// INF("Invalid file (%s) (missing section)", file); INF("Invalid file (%s) (missing section)", file);
goto next_line; goto error;
} }
/* find for '=' */ /* find for '=' */
for (sep = 0; (sep < line_length) && (line_start[sep] != '='); ++sep) for (sep = 0; (sep < line_length) && (line_start[sep] != '='); ++sep)
; ;
if (sep < line_length) if (sep < line_length && line_start[sep] == '=')
{ {
char *key, *value; char *key, *value;
int key_end, value_start, value_end; int key_end, value_start, value_end;
@ -257,11 +257,12 @@ efreet_ini_parse(const char *file)
eina_hash_del_by_key(section, key); eina_hash_del_by_key(section, key);
eina_hash_add(section, key, efreet_ini_unescape(value)); eina_hash_add(section, key, efreet_ini_unescape(value));
} }
// else else
// { {
// /* invalid file... */ /* invalid file... */
// INF("Invalid file (%s) (missing = from key=value pair)", file); INF("Invalid file (%s) (missing = from key=value pair)", file);
// } goto error;
}
next_line: next_line:
left -= line_length + 1; left -= line_length + 1;
@ -278,6 +279,9 @@ next_line:
} }
#endif #endif
return data; return data;
error:
if (data) eina_hash_free(data);
return NULL;
} }
EAPI void EAPI void