Commit e7bb0443 authored by Damien George's avatar Damien George
Browse files

py: Properly free string parse-node; add assertion to gc_free.

parent dd4f4530
......@@ -484,7 +484,11 @@ void gc_free(void *ptr_in) {
#if EXTENSIVE_HEAP_PROFILING
gc_dump_alloc_table();
#endif
} else {
assert(!"bad free");
}
} else if (ptr_in != NULL) {
assert(!"bad free");
}
}
......
......@@ -180,8 +180,7 @@ void mp_parse_node_free(mp_parse_node_t pn) {
mp_uint_t rule_id = MP_PARSE_NODE_STRUCT_KIND(pns);
if (rule_id == RULE_string) {
m_del(char, (char*)pns->nodes[0], (mp_uint_t)pns->nodes[1]);
return;
}
} else {
bool adjust = ADD_BLANK_NODE(rule_id);
if (adjust) {
n--;
......@@ -192,6 +191,7 @@ void mp_parse_node_free(mp_parse_node_t pn) {
if (adjust) {
n++;
}
}
m_del_var(mp_parse_node_struct_t, mp_parse_node_t, n, pns);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment