summaryrefslogtreecommitdiff
path: root/src/lib/ecore_file
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-12-15 11:18:38 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-12-15 11:18:38 +0900
commitf1fa8de149b7622426acfd4ea4926e9d34a73e0d (patch)
tree187029c3978eabe341e31f778b181b82a13d3d49 /src/lib/ecore_file
parentd3caca21e5d2231d7aeca423d7a7ff1f5aa48cc4 (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
Diffstat (limited to 'src/lib/ecore_file')
-rw-r--r--src/lib/ecore_file/ecore_file.c14
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 efca2c8d83..943ed4d7f2 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)
857EAPI char * 857EAPI char *
858ecore_file_app_exe_get(const char *app) 858ecore_file_app_exe_get(const char *app)
859{ 859{
860 char *p, *pp = NULL, *exe1 = NULL, *exe2 = NULL; 860 char *p, *pp, *exe1 = NULL, *exe2 = NULL;
861 char *exe = NULL; 861 char *exe = NULL;
862 int in_quot_dbl = 0, in_quot_sing = 0, restart = 0; 862 int in_quot_dbl = 0, in_quot_sing = 0, restart = 0;
863 863
@@ -901,11 +901,7 @@ restart:
901 exe1++; 901 exe1++;
902 902
903 homedir = getenv("HOME"); 903 homedir = getenv("HOME");
904 if (!homedir) 904 if (!homedir) return NULL;
905 {
906 if (pp) free(pp);
907 return NULL;
908 }
909 len = strlen(homedir); 905 len = strlen(homedir);
910 if (exe) free(exe); 906 if (exe) free(exe);
911 exe = malloc(len + exe2 - exe1 + 2); 907 exe = malloc(len + exe2 - exe1 + 2);
@@ -987,7 +983,11 @@ restart:
987 else if (isspace((unsigned char)*p)) 983 else if (isspace((unsigned char)*p))
988 { 984 {
989 if (restart) 985 if (restart)
990 goto restart; 986 {
987 if (exe) free(exe);
988 exe = NULL;
989 goto restart;
990 }
991 else 991 else
992 break; 992 break;
993 } 993 }