hare

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

commit 0e9c33407693ee1b2bd56ddb81b83782f465bf8a
parent 3a46aabe089e94eb74df1afc33cb48459294db20
Author: Alexey Yerin <yyp@disroot.org>
Date:   Sun,  9 May 2021 19:46:28 +0300

Fix module::identpath memory leaks

Diffstat:
Mcmd/haredoc/html.ha | 2++
Mhare/module/scan.ha | 1+
2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/cmd/haredoc/html.ha b/cmd/haredoc/html.ha @@ -241,11 +241,13 @@ fn htmlref(ctx: *context, ref: ast::ident) (void | io::error) = { fmt::printf("<a href='#{0}' class='ref'>{0}</a>", ident)?, symkind::MODULE => { let ipath = module::identpath(id); + defer free(ipath); fmt::printf("<a href='/{}' class='ref'>{}</a>", ipath, ident)?; }, symkind::SYMBOL => { let ipath = module::identpath(id[..len(id) - 1]); + defer free(ipath); fmt::printf("<a href='/{}#{}' class='ref'>{}</a>", ipath, id[len(id) - 1], ident)?; }, diff --git a/hare/module/scan.ha b/hare/module/scan.ha @@ -279,6 +279,7 @@ fn scan_directory( // which includes all eligible build inputs. export fn lookup(ctx: *context, name: ast::ident) (version | error) = { let ipath = identpath(name); + defer free(ipath); for (let i = len(ctx.paths); i > 0; i -= 1) { let cand = path::join(ctx.paths[i - 1], ipath); defer free(cand);