summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorThiep Ha <thiep.ha@samsung.com>2014-12-18 09:17:03 +0900
committerChunEon Park <hermet@hermet.pe.kr>2014-12-18 09:17:03 +0900
commitc27b511b28d24ad07cb28cf84e56c475b83603e4 (patch)
treebdcebe958f1f95c5a9e27954d9dee1eab8595553 /src/bin
parent0f5a5fc19e305b366db58a2d44ca74fddd2b5aca (diff)
edje: fix memory leak in epp
Summary: Variable include_defaults can be allocated and go out of scope without freeing it. Reviewers: cedric, seoz, woohyun, Hermet Reviewed By: Hermet Differential Revision: https://phab.enlightenment.org/D1784
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/edje/epp/cpplib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bin/edje/epp/cpplib.c b/src/bin/edje/epp/cpplib.c
index 0659000f01..10ab5d873d 100644
--- a/src/bin/edje/epp/cpplib.c
+++ b/src/bin/edje/epp/cpplib.c
@@ -5686,6 +5686,7 @@ push_parse_file(cpp_reader * pfile, const char *fname)
5686 char *p; 5686 char *p;
5687 int f; 5687 int f;
5688 cpp_buffer *fp; 5688 cpp_buffer *fp;
5689 char *epath = 0;
5689 5690
5690 /* The code looks at the defaults through this pointer, rather than through 5691 /* The code looks at the defaults through this pointer, rather than through
5691 * the constant structure above. This pointer gets changed if an environment 5692 * the constant structure above. This pointer gets changed if an environment
@@ -5833,8 +5834,6 @@ push_parse_file(cpp_reader * pfile, const char *fname)
5833 5834
5834 { /* read the appropriate environment variable and if it exists 5835 { /* read the appropriate environment variable and if it exists
5835 * replace include_defaults with the listed path. */ 5836 * replace include_defaults with the listed path. */
5836 char *epath = 0;
5837
5838 switch ((opts->objc << 1) + opts->cplusplus) 5837 switch ((opts->objc << 1) + opts->cplusplus)
5839 { 5838 {
5840 case 0: 5839 case 0:
@@ -6008,6 +6007,7 @@ push_parse_file(cpp_reader * pfile, const char *fname)
6008 if (fd < 0) 6007 if (fd < 0)
6009 { 6008 {
6010 cpp_perror_with_name(pfile, pend->arg); 6009 cpp_perror_with_name(pfile, pend->arg);
6010 if (epath) free(include_defaults);
6011 return FATAL_EXIT_CODE; 6011 return FATAL_EXIT_CODE;
6012 } 6012 }
6013 cpp_push_buffer(pfile, NULL, 0); 6013 cpp_push_buffer(pfile, NULL, 0);
@@ -6153,6 +6153,7 @@ push_parse_file(cpp_reader * pfile, const char *fname)
6153 { 6153 {
6154 cpp_perror_with_name(pfile, pend->arg); 6154 cpp_perror_with_name(pfile, pend->arg);
6155 if (f) close(f); 6155 if (f) close(f);
6156 if (epath) free(include_defaults);
6156 return FATAL_EXIT_CODE; 6157 return FATAL_EXIT_CODE;
6157 } 6158 }
6158 cpp_push_buffer(pfile, NULL, 0); 6159 cpp_push_buffer(pfile, NULL, 0);
@@ -6173,6 +6174,7 @@ push_parse_file(cpp_reader * pfile, const char *fname)
6173 6174
6174 if (finclude(pfile, f, fname, 0, NULL)) 6175 if (finclude(pfile, f, fname, 0, NULL))
6175 output_line_command(pfile, 0, same_file); 6176 output_line_command(pfile, 0, same_file);
6177 if (epath) free(include_defaults);
6176 return SUCCESS_EXIT_CODE; 6178 return SUCCESS_EXIT_CODE;
6177} 6179}
6178 6180