forked from enlightenment/efl
ecore-file - fix mem leak in ecore_file_app_exe_get() on restart
this actually fixes the issue. coverity did point it out but i fixed it incorrectly. since it was still there in the scan i now fixed it properly. fixes CID 1039279
This commit is contained in:
parent
d3caca21e5
commit
f1fa8de149
|
@ -857,7 +857,7 @@ ecore_file_ls(const char *dir)
|
|||
EAPI char *
|
||||
ecore_file_app_exe_get(const char *app)
|
||||
{
|
||||
char *p, *pp = NULL, *exe1 = NULL, *exe2 = NULL;
|
||||
char *p, *pp, *exe1 = NULL, *exe2 = NULL;
|
||||
char *exe = NULL;
|
||||
int in_quot_dbl = 0, in_quot_sing = 0, restart = 0;
|
||||
|
||||
|
@ -901,11 +901,7 @@ restart:
|
|||
exe1++;
|
||||
|
||||
homedir = getenv("HOME");
|
||||
if (!homedir)
|
||||
{
|
||||
if (pp) free(pp);
|
||||
return NULL;
|
||||
}
|
||||
if (!homedir) return NULL;
|
||||
len = strlen(homedir);
|
||||
if (exe) free(exe);
|
||||
exe = malloc(len + exe2 - exe1 + 2);
|
||||
|
@ -987,7 +983,11 @@ restart:
|
|||
else if (isspace((unsigned char)*p))
|
||||
{
|
||||
if (restart)
|
||||
goto restart;
|
||||
{
|
||||
if (exe) free(exe);
|
||||
exe = NULL;
|
||||
goto restart;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue