forked from enlightenment/efl
ecore_file - finding exe path - if HOME is not set a leak could happen
this fixes CID 1039279
This commit is contained in:
parent
e4b029da0b
commit
f8b5dcf126
|
@ -857,7 +857,7 @@ ecore_file_ls(const char *dir)
|
||||||
EAPI char *
|
EAPI char *
|
||||||
ecore_file_app_exe_get(const char *app)
|
ecore_file_app_exe_get(const char *app)
|
||||||
{
|
{
|
||||||
char *p, *pp, *exe1 = NULL, *exe2 = NULL;
|
char *p, *pp = NULL, *exe1 = NULL, *exe2 = NULL;
|
||||||
char *exe = NULL;
|
char *exe = NULL;
|
||||||
int in_quot_dbl = 0, in_quot_sing = 0, restart = 0;
|
int in_quot_dbl = 0, in_quot_sing = 0, restart = 0;
|
||||||
|
|
||||||
|
@ -901,7 +901,11 @@ restart:
|
||||||
exe1++;
|
exe1++;
|
||||||
|
|
||||||
homedir = getenv("HOME");
|
homedir = getenv("HOME");
|
||||||
if (!homedir) return NULL;
|
if (!homedir)
|
||||||
|
{
|
||||||
|
if (pp) free(pp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
len = strlen(homedir);
|
len = strlen(homedir);
|
||||||
if (exe) free(exe);
|
if (exe) free(exe);
|
||||||
exe = malloc(len + exe2 - exe1 + 2);
|
exe = malloc(len + exe2 - exe1 + 2);
|
||||||
|
|
Loading…
Reference in New Issue