aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/edje
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-04-09 11:14:07 +0900
committerHermet Park <hermetpark@gmail.com>2018-04-09 11:14:07 +0900
commitd5c913c60b4f7234010800bed8fe4ddd15edbb80 (patch)
treec770a320a639673a65d7682312a060ae4c343670 /src/bin/edje
parentgendoc-mono: Add documentation generation for C# language (diff)
downloadefl-d5c913c60b4f7234010800bed8fe4ddd15edbb80.tar.gz
edje: fix potential memory leak.
next_token() requires free() for it's returned value and a string attribute Here logic didn't take care of the memory usage. @fix
Diffstat (limited to 'src/bin/edje')
-rw-r--r--src/bin/edje/edje_cc_script.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/bin/edje/edje_cc_script.c b/src/bin/edje/edje_cc_script.c
index e17355c78b..657bf4fb96 100644
--- a/src/bin/edje/edje_cc_script.c
+++ b/src/bin/edje/edje_cc_script.c
@@ -64,7 +64,7 @@ static void
code_parse_internal(Code *code)
{
Code_Symbol *sym = NULL, *func = NULL;
- Token *token, *tmp;
+ Token *token, *tmp = NULL;
char *begin = code->shared;
char *end = begin + strlen(begin);
char *body;
@@ -92,9 +92,18 @@ code_parse_internal(Code *code)
token = tmp;
break;
}
+
+ if (tmp->str) free(tmp->str);
+ free(tmp);
}
}
+ if (tmp)
+ {
+ if (tmp->str) free(tmp->str);
+ free(tmp);
+ }
+
switch (token->type)
{
case TOKEN_TYPE_COLON:
@@ -176,6 +185,9 @@ code_parse_internal(Code *code)
}
if (!depth)
break;
+
+ if (tmp->str) free(tmp->str);
+ free(tmp);
}
if ((begin - 1) > body)
{
@@ -204,6 +216,12 @@ code_parse_internal(Code *code)
if (token->str)
free(token->str);
free(token);
+
+ if (tmp)
+ {
+ if (tmp->str) free(tmp->str);
+ free(tmp);
+ }
}
eina_array_free(name_stack);