forked from enlightenment/efl
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>
This commit is contained in:
parent
99c56369f2
commit
e520d3128e
|
@ -6285,12 +6285,14 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv)
|
||||||
{
|
{
|
||||||
file_name_list *dirtmp;
|
file_name_list *dirtmp;
|
||||||
char *prefix;
|
char *prefix;
|
||||||
|
int is_prefix_alloc = 0;
|
||||||
|
|
||||||
if (opts->include_prefix)
|
if (opts->include_prefix)
|
||||||
prefix = opts->include_prefix;
|
prefix = opts->include_prefix;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
prefix = savestring(GCC_INCLUDE_DIR);
|
prefix = savestring(GCC_INCLUDE_DIR);
|
||||||
|
is_prefix_alloc++;
|
||||||
/* Remove the `include' from /usr/local/lib/gcc.../include. */
|
/* Remove the `include' from /usr/local/lib/gcc.../include. */
|
||||||
if (!strcmp
|
if (!strcmp
|
||||||
(prefix + strlen(prefix) - 8, "/include"))
|
(prefix + strlen(prefix) - 8, "/include"))
|
||||||
|
@ -6318,6 +6320,7 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv)
|
||||||
else
|
else
|
||||||
opts->last_after_include->next = dirtmp;
|
opts->last_after_include->next = dirtmp;
|
||||||
opts->last_after_include = dirtmp; /* Tail follows the last one */
|
opts->last_after_include = dirtmp; /* Tail follows the last one */
|
||||||
|
if (is_prefix_alloc) free(prefix);
|
||||||
}
|
}
|
||||||
/* Add directory to main path for includes,
|
/* Add directory to main path for includes,
|
||||||
* with the default prefix at the front of its name. */
|
* with the default prefix at the front of its name. */
|
||||||
|
@ -6325,12 +6328,14 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv)
|
||||||
{
|
{
|
||||||
file_name_list *dirtmp;
|
file_name_list *dirtmp;
|
||||||
char *prefix;
|
char *prefix;
|
||||||
|
int is_prefix_alloc = 0;
|
||||||
|
|
||||||
if (opts->include_prefix)
|
if (opts->include_prefix)
|
||||||
prefix = opts->include_prefix;
|
prefix = opts->include_prefix;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
prefix = savestring(GCC_INCLUDE_DIR);
|
prefix = savestring(GCC_INCLUDE_DIR);
|
||||||
|
is_prefix_alloc++;
|
||||||
/* Remove the `include' from /usr/local/lib/gcc.../include. */
|
/* Remove the `include' from /usr/local/lib/gcc.../include. */
|
||||||
if (!strcmp
|
if (!strcmp
|
||||||
(prefix + strlen(prefix) - 8, "/include"))
|
(prefix + strlen(prefix) - 8, "/include"))
|
||||||
|
@ -6354,6 +6359,7 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv)
|
||||||
dirtmp->got_name_map = 0;
|
dirtmp->got_name_map = 0;
|
||||||
|
|
||||||
append_include_chain(pfile, dirtmp, dirtmp);
|
append_include_chain(pfile, dirtmp, dirtmp);
|
||||||
|
if (is_prefix_alloc) free(prefix);
|
||||||
}
|
}
|
||||||
/* Add directory to end of path for includes. */
|
/* Add directory to end of path for includes. */
|
||||||
if (!strcmp(argv[i], "-idirafter"))
|
if (!strcmp(argv[i], "-idirafter"))
|
||||||
|
|
Loading…
Reference in New Issue