raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f1fa8de149b7622426acfd4ea4926e9d34a73e0d

commit f1fa8de149b7622426acfd4ea4926e9d34a73e0d
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Sun Dec 15 11:18:38 2013 +0900

    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
---
 src/lib/ecore_file/ecore_file.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c
index efca2c8..943ed4d 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;
                }

-- 


Reply via email to