diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2013-12-15 11:18:38 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2013-12-15 11:18:38 +0900 |
commit | f1fa8de149b7622426acfd4ea4926e9d34a73e0d (patch) | |
tree | 187029c3978eabe341e31f778b181b82a13d3d49 | |
parent | d3caca21e5d2231d7aeca423d7a7ff1f5aa48cc4 (diff) |
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
-rw-r--r-- | src/lib/ecore_file/ecore_file.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c index efca2c8d8..943ed4d7f 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 = 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; } |