diff options
author | Anand <anand.km@samsung.com> | 2014-09-22 14:12:02 +0200 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2014-09-22 14:59:27 +0200 |
commit | e520d3128edcdc1f8d1270107001886a3852a91f (patch) | |
tree | 8c90e323f9d3c6371ac0fdc8804ff31f965d7a6e /src/bin/edje | |
parent | 99c56369f25ac52e303a769afb7210508be88709 (diff) |
edje: fix resourse leak in epp.
Summary: Variable prefix going out of scope leaks the storage it points to.
Reviewers: seoz, singh.amitesh, cedric
Reviewed By: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1468
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/bin/edje')
-rw-r--r-- | src/bin/edje/epp/cpplib.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bin/edje/epp/cpplib.c b/src/bin/edje/epp/cpplib.c index 77da3acdbf..7c371cfd69 100644 --- a/src/bin/edje/epp/cpplib.c +++ b/src/bin/edje/epp/cpplib.c | |||
@@ -6285,12 +6285,14 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv) | |||
6285 | { | 6285 | { |
6286 | file_name_list *dirtmp; | 6286 | file_name_list *dirtmp; |
6287 | char *prefix; | 6287 | char *prefix; |
6288 | int is_prefix_alloc = 0; | ||
6288 | 6289 | ||
6289 | if (opts->include_prefix) | 6290 | if (opts->include_prefix) |
6290 | prefix = opts->include_prefix; | 6291 | prefix = opts->include_prefix; |
6291 | else | 6292 | else |
6292 | { | 6293 | { |
6293 | prefix = savestring(GCC_INCLUDE_DIR); | 6294 | prefix = savestring(GCC_INCLUDE_DIR); |
6295 | is_prefix_alloc++; | ||
6294 | /* Remove the `include' from /usr/local/lib/gcc.../include. */ | 6296 | /* Remove the `include' from /usr/local/lib/gcc.../include. */ |
6295 | if (!strcmp | 6297 | if (!strcmp |
6296 | (prefix + strlen(prefix) - 8, "/include")) | 6298 | (prefix + strlen(prefix) - 8, "/include")) |
@@ -6318,6 +6320,7 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv) | |||
6318 | else | 6320 | else |
6319 | opts->last_after_include->next = dirtmp; | 6321 | opts->last_after_include->next = dirtmp; |
6320 | opts->last_after_include = dirtmp; /* Tail follows the last one */ | 6322 | opts->last_after_include = dirtmp; /* Tail follows the last one */ |
6323 | if (is_prefix_alloc) free(prefix); | ||
6321 | } | 6324 | } |
6322 | /* Add directory to main path for includes, | 6325 | /* Add directory to main path for includes, |
6323 | * with the default prefix at the front of its name. */ | 6326 | * with the default prefix at the front of its name. */ |
@@ -6325,12 +6328,14 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv) | |||
6325 | { | 6328 | { |
6326 | file_name_list *dirtmp; | 6329 | file_name_list *dirtmp; |
6327 | char *prefix; | 6330 | char *prefix; |
6331 | int is_prefix_alloc = 0; | ||
6328 | 6332 | ||
6329 | if (opts->include_prefix) | 6333 | if (opts->include_prefix) |
6330 | prefix = opts->include_prefix; | 6334 | prefix = opts->include_prefix; |
6331 | else | 6335 | else |
6332 | { | 6336 | { |
6333 | prefix = savestring(GCC_INCLUDE_DIR); | 6337 | prefix = savestring(GCC_INCLUDE_DIR); |
6338 | is_prefix_alloc++; | ||
6334 | /* Remove the `include' from /usr/local/lib/gcc.../include. */ | 6339 | /* Remove the `include' from /usr/local/lib/gcc.../include. */ |
6335 | if (!strcmp | 6340 | if (!strcmp |
6336 | (prefix + strlen(prefix) - 8, "/include")) | 6341 | (prefix + strlen(prefix) - 8, "/include")) |
@@ -6354,6 +6359,7 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv) | |||
6354 | dirtmp->got_name_map = 0; | 6359 | dirtmp->got_name_map = 0; |
6355 | 6360 | ||
6356 | append_include_chain(pfile, dirtmp, dirtmp); | 6361 | append_include_chain(pfile, dirtmp, dirtmp); |
6362 | if (is_prefix_alloc) free(prefix); | ||
6357 | } | 6363 | } |
6358 | /* Add directory to end of path for includes. */ | 6364 | /* Add directory to end of path for includes. */ |
6359 | if (!strcmp(argv[i], "-idirafter")) | 6365 | if (!strcmp(argv[i], "-idirafter")) |