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:
Carsten Haitzler 2013-12-15 11:18:38 +09:00
parent d3caca21e5
commit f1fa8de149
1 changed files with 7 additions and 7 deletions

View File

@ -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;
}