From 3bd4358a37ccb0b2284b5f7f0770899fe01edf85 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Wed, 7 Jul 2021 18:07:17 +0200 Subject: [PATCH] Berry fix GC when lexer error --- lib/libesp32/Berry/src/be_lexer.c | 1 - lib/libesp32/Berry/src/be_parser.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libesp32/Berry/src/be_lexer.c b/lib/libesp32/Berry/src/be_lexer.c index eea82109d..af987113d 100644 --- a/lib/libesp32/Berry/src/be_lexer.c +++ b/lib/libesp32/Berry/src/be_lexer.c @@ -572,7 +572,6 @@ void be_lexer_deinit(blexer *lexer) { be_free(lexer->vm, lexer->buf.s, lexer->buf.size); keyword_unregiste(lexer->vm); - be_stackpop(lexer->vm, 1); /* pop strtab */ } int be_lexer_scan_next(blexer *lexer) diff --git a/lib/libesp32/Berry/src/be_parser.c b/lib/libesp32/Berry/src/be_parser.c index 1839e9392..62df59b85 100644 --- a/lib/libesp32/Berry/src/be_parser.c +++ b/lib/libesp32/Berry/src/be_parser.c @@ -1520,7 +1520,7 @@ bclosure* be_parser_source(bvm *vm, mainfunc(&parser, cl); be_lexer_deinit(&parser.lexer); be_global_release_space(vm); /* clear global space */ - be_stackpop(vm, 1); + be_stackpop(vm, 2); /* pop strtab */ scan_next_token(&parser); /* clear lexer */ return cl; }