hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit d7a5971a23cf972ea102e11284db8421426428ed
parent efc309916b8cc1d84f165dfc4011af532948b6e4
Author: Alexey Yerin <yyp@disroot.org>
Date:   Sun,  9 May 2021 19:46:31 +0300

hare::module: free tags on return

Diffstat:
Mhare/module/scan.ha | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hare/module/scan.ha b/hare/module/scan.ha @@ -351,7 +351,6 @@ fn have_ident(sl: *[]ast::ident, id: ast::ident) bool = { // set. The caller must free the return value with [[tags_free]]. export fn parsetags(in: str) ([]tag | void) = { let tags: []tag = []; - // defer! tags_free(tags); let iter = strings::iter(in); for (true) { let t = tag { ... }; @@ -360,7 +359,10 @@ export fn parsetags(in: str) ([]tag | void) = { r: rune => r, }; t.mode = switch (m) { - * => return, + * => { + tags_free(tags); + return; + }, '+' => tag_mode::INCLUSIVE, '-' => tag_mode::EXCLUSIVE, };