summaryrefslogtreecommitdiff
path: root/py/compile.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-11-26 23:37:19 +1100
committerDamien George <damien.p.george@gmail.com>2017-12-11 13:49:09 +1100
commit1e5a33df413bbd8a8aa5bd880be445c684fc5506 (patch)
tree38e8bdbe9e64711485909c58458bc44b6a6a34fb /py/compile.c
parent02d830c035aca166d70551e485ccd2d1658189c9 (diff)
py: Convert all uses of alloca() to use new scoped allocation API.
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/py/compile.c b/py/compile.c
index ee017498a..52d10ee5e 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -1050,7 +1050,7 @@ STATIC void do_import_name(compiler_t *comp, mp_parse_node_t pn, qstr *q_base) {
for (int i = 0; i < n; i++) {
len += qstr_len(MP_PARSE_NODE_LEAF_ARG(pns->nodes[i]));
}
- char *q_ptr = alloca(len);
+ char *q_ptr = mp_local_alloc(len);
char *str_dest = q_ptr;
for (int i = 0; i < n; i++) {
if (i > 0) {
@@ -1062,6 +1062,7 @@ STATIC void do_import_name(compiler_t *comp, mp_parse_node_t pn, qstr *q_base) {
str_dest += str_src_len;
}
qstr q_full = qstr_from_strn(q_ptr, len);
+ mp_local_free(q_ptr);
EMIT_ARG(import_name, q_full);
if (is_as) {
for (int i = 1; i < n; i++) {