summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-12-13 21:23:07 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-12-13 21:26:05 +0900
commitf8b5dcf126664a8b3c2cea03420e7bbd2a0c569a (patch)
tree3c47af0ad6e2de6c83de84b7bbc76dbe2292476f
parente4b029da0b237745314d5d28609f3f81d479215f (diff)
ecore_file - finding exe path - if HOME is not set a leak could happen
this fixes CID 1039279
-rw-r--r--src/lib/ecore_file/ecore_file.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c
index 634709f04..efca2c8d8 100644
--- a/src/lib/ecore_file/ecore_file.c
+++ b/src/lib/ecore_file/ecore_file.c
@@ -857,7 +857,7 @@ ecore_file_ls(const char *dir)
EAPI char *
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;
int in_quot_dbl = 0, in_quot_sing = 0, restart = 0;
@@ -901,7 +901,11 @@ restart:
exe1++;
homedir = getenv("HOME");
- if (!homedir) return NULL;
+ if (!homedir)
+ {
+ if (pp) free(pp);
+ return NULL;
+ }
len = strlen(homedir);
if (exe) free(exe);
exe = malloc(len + exe2 - exe1 + 2);