forked from enlightenment/efl
fix memleak and use realpath directly
SVN revision: 54927
This commit is contained in:
parent
cc981aba4d
commit
b645d20ab2
|
@ -230,6 +230,7 @@ efreet_dirs_get(const char *key, const char *fallback)
|
|||
Eina_List *dirs = NULL;
|
||||
const char *path;
|
||||
char *tmp, *s, *p;
|
||||
char ts[PATH_MAX];
|
||||
size_t len;
|
||||
|
||||
path = getenv(key);
|
||||
|
@ -249,12 +250,8 @@ efreet_dirs_get(const char *key, const char *fallback)
|
|||
{
|
||||
// resolve path properly/fully to remove path//path2 to
|
||||
// path/path2, path/./path2 to path/path2 etc.
|
||||
char *ts = ecore_file_realpath(s);
|
||||
if (ts && ts[0])
|
||||
{
|
||||
if (realpath(s, ts))
|
||||
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(ts));
|
||||
free(ts);
|
||||
}
|
||||
}
|
||||
|
||||
s = ++p;
|
||||
|
@ -264,12 +261,8 @@ efreet_dirs_get(const char *key, const char *fallback)
|
|||
{
|
||||
// resolve path properly/fully to remove path//path2 to
|
||||
// path/path2, path/./path2 to path/path2 etc.
|
||||
char *ts = ecore_file_realpath(s);
|
||||
if (ts && ts[0])
|
||||
{
|
||||
if (realpath(s, ts))
|
||||
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(ts));
|
||||
free(ts);
|
||||
}
|
||||
}
|
||||
|
||||
return dirs;
|
||||
|
|
|
@ -1649,15 +1649,14 @@ efreet_menu_merge(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char *pat
|
|||
{
|
||||
Efreet_Xml *merge_xml;
|
||||
Efreet_Menu_Internal *internal;
|
||||
char *rp;
|
||||
char rp[PATH_MAX];
|
||||
|
||||
if (!parent || !xml || !path) return 0;
|
||||
|
||||
/* do nothing if the file doesn't exist */
|
||||
if (!ecore_file_exists(path)) return 1;
|
||||
|
||||
rp = ecore_file_realpath(path);
|
||||
if (rp[0] == '\0')
|
||||
if (!realpath(path, rp))
|
||||
{
|
||||
INF("efreet_menu_merge() unable to get real path for %s", path);
|
||||
return 0;
|
||||
|
@ -1666,7 +1665,6 @@ efreet_menu_merge(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char *pat
|
|||
/* don't merge the same path twice */
|
||||
if (eina_hash_find(efreet_merged_menus, rp))
|
||||
{
|
||||
FREE(rp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1678,12 +1676,9 @@ efreet_menu_merge(Efreet_Menu_Internal *parent, Efreet_Xml *xml, const char *pat
|
|||
{
|
||||
INF("efreet_menu_merge() failed to read in the "
|
||||
"merge file (%s)", rp);
|
||||
FREE(rp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
FREE(rp);
|
||||
|
||||
internal = efreet_menu_internal_new();
|
||||
if (!internal) return 0;
|
||||
efreet_menu_path_set(internal, path);
|
||||
|
|
Loading…
Reference in New Issue