Change memory allocation API to require size for free and realloc.
diff --git a/py/compile.c b/py/compile.c
index 38f1415..604d5a2 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -1184,7 +1184,7 @@
}
strcat(str, qstr_str(MP_PARSE_NODE_LEAF_ARG(pns->nodes[i])));
}
- *q2 = qstr_from_str_take(str);
+ *q2 = qstr_from_str_take(str, len + 1);
EMIT(import_name, *q2);
if (is_as) {
for (int i = 1; i < n; i++) {
@@ -2127,7 +2127,7 @@
strcat(cat_str, str);
}
- EMIT(load_const_str, qstr_from_str_take(cat_str), string_kind == MP_PARSE_NODE_BYTES);
+ EMIT(load_const_str, qstr_from_str_take(cat_str, n_bytes + 1), string_kind == MP_PARSE_NODE_BYTES);
}
// pns needs to have 2 nodes, first is lhs of comprehension, second is PN_comp_for node
@@ -3105,7 +3105,7 @@
}
}
- m_free(comp);
+ m_del_obj(compiler_t, comp);
return !comp->had_error;
}