summaryrefslogtreecommitdiffstatshomepage
path: root/py/scope.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-01-23 14:27:40 -0800
committerDamien George <damien.p.george@gmail.com>2014-01-23 14:27:40 -0800
commitd552db426b3b79813a6269e4c18519b2d22195e4 (patch)
tree9b13316843e02bd5587b24f668d3783f578e0318 /py/scope.c
parent3257d3543becc23b045c94e99f814e80d306d235 (diff)
parentfd31358505dd794feb153c00bec6d4ee92c851d1 (diff)
downloadmicropython-d552db426b3b79813a6269e4c18519b2d22195e4.tar.gz
micropython-d552db426b3b79813a6269e4c18519b2d22195e4.zip
Merge pull request #214 from pfalcon/compile-mem-leaks
Memory leaks in lexer/compiler
Diffstat (limited to 'py/scope.c')
-rw-r--r--py/scope.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/scope.c b/py/scope.c
index 1d240bb63e..1f602ac9c0 100644
--- a/py/scope.c
+++ b/py/scope.c
@@ -60,6 +60,11 @@ scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, uint
return scope;
}
+void scope_free(scope_t *scope) {
+ m_del(id_info_t, scope->id_info, scope->id_info_alloc);
+ m_del(scope_t, scope, 1);
+}
+
id_info_t *scope_find_or_add_id(scope_t *scope, qstr qstr, bool *added) {
for (int i = 0; i < scope->id_info_len; i++) {
if (scope->id_info[i].qstr == qstr) {