summaryrefslogtreecommitdiff
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
parent94702524505f93b9a7f8ac9192ce6fdd88271423 (diff)
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
-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
64code_parse_internal(Code *code) 64code_parse_internal(Code *code)
65{ 65{
66 Code_Symbol *sym = NULL, *func = NULL; 66 Code_Symbol *sym = NULL, *func = NULL;
67 Token *token, *tmp; 67 Token *token, *tmp = NULL;
68 char *begin = code->shared; 68 char *begin = code->shared;
69 char *end = begin + strlen(begin); 69 char *end = begin + strlen(begin);
70 char *body; 70 char *body;
@@ -92,9 +92,18 @@ code_parse_internal(Code *code)
92 token = tmp; 92 token = tmp;
93 break; 93 break;
94 } 94 }
95
96 if (tmp->str) free(tmp->str);
97 free(tmp);
95 } 98 }
96 } 99 }
97 100
101 if (tmp)
102 {
103 if (tmp->str) free(tmp->str);
104 free(tmp);
105 }
106
98 switch (token->type) 107 switch (token->type)
99 { 108 {
100 case TOKEN_TYPE_COLON: 109 case TOKEN_TYPE_COLON:
@@ -176,6 +185,9 @@ code_parse_internal(Code *code)
176 } 185 }
177 if (!depth) 186 if (!depth)
178 break; 187 break;
188
189 if (tmp->str) free(tmp->str);
190 free(tmp);
179 } 191 }
180 if ((begin - 1) > body) 192 if ((begin - 1) > body)
181 { 193 {
@@ -204,6 +216,12 @@ code_parse_internal(Code *code)
204 if (token->str) 216 if (token->str)
205 free(token->str); 217 free(token->str);
206 free(token); 218 free(token);
219
220 if (tmp)
221 {
222 if (tmp->str) free(tmp->str);
223 free(tmp);
224 }
207 } 225 }
208 226
209 eina_array_free(name_stack); 227 eina_array_free(name_stack);