hermet pushed a commit to branch master.

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

commit 6d0b834a76c3301bf4c4b29752f902dbe8a8525e
Author: Thiep Ha <thiep...@samsung.com>
Date:   Thu Dec 18 09:05:50 2014 +0900

    edje: free allocated memory in epp
    
    Summary: fname variable's memory is allocated but not freed.
    
    Reviewers: cedric, seoz, woohyun, Hermet
    
    Reviewed By: Hermet
    
    Differential Revision: https://phab.enlightenment.org/D1785
---
 src/bin/edje/epp/cpplib.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/bin/edje/epp/cpplib.c b/src/bin/edje/epp/cpplib.c
index 632ffe2..3cfc3a8 100644
--- a/src/bin/edje/epp/cpplib.c
+++ b/src/bin/edje/epp/cpplib.c
@@ -3325,13 +3325,19 @@ do_include(cpp_reader * pfile, struct directive 
*keyword,
        strncpy(fname, (const char *)fbeg, flen);
        fname[flen] = 0;
        if (redundant_include_p(pfile, fname))
-          return 0;
+      {
+         free(fname);
+         return 0;
+      }
        if (importing)
           f = lookup_import(pfile, fname, NULL);
        else
           f = open_include_file(pfile, fname, NULL);
        if (f == -2)
-          return 0;            /* Already included this file */
+      {
+         free(fname);
+         return 0;             /* Already included this file */
+      }
      }
    else
      {
@@ -3380,13 +3386,19 @@ do_include(cpp_reader * pfile, struct directive 
*keyword,
              * of redundant include files: #import, #pragma once, and
              * redundant_include_p.  It would be nice if they were unified.  */
             if (redundant_include_p(pfile, fname))
-               return 0;
+           {
+              free(fname);
+              return 0;
+           }
             if (importing)
                f = lookup_import(pfile, fname, searchptr);
             else
                f = open_include_file(pfile, fname, searchptr);
             if (f == -2)
-               return 0;       /* Already included this file */
+           {
+              free(fname);
+              return 0;        /* Already included this file */
+           }
 #ifdef EACCES
             else if (f == -1 && errno == EACCES)
                cpp_warning(pfile, "Header file %s exists, but is not readable",
@@ -3467,6 +3479,7 @@ do_include(cpp_reader * pfile, struct directive *keyword,
             if (!strcmp(ptr->fname, fname))
               {
                  close(f);
+          free(fname);
                  return 0;     /* This file was once'd. */
               }
          }
@@ -3524,6 +3537,7 @@ do_include(cpp_reader * pfile, struct directive *keyword,
        if (angle_brackets)
           pfile->system_include_depth--;
      }
+   free(fname);
    return 0;
 }
 

-- 


Reply via email to