hare

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

commit 1a4b32d60edbea3f317358a9e53d58834f16938a
parent b609e6cea969f07342ca8e215b8787762b89303f
Author: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Date:   Mon, 13 Sep 2021 03:29:02 +0200

hare::types: type_finish shouldn't be recursive

This caused a lot of double frees.

Signed-off-by: Bor Grošelj Simić <bor.groseljsimic@telemach.net>

Diffstat:
Mhare/types/store.ha | 17+++--------------
1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/hare/types/store.ha b/hare/types/store.ha @@ -509,21 +509,10 @@ fn type_finish(t: *_type) void = { a: alias => ast::ident_free(a.id), array => void, builtin => void, - e: _enum => { - for (let i = 0z; i < len(e.values); i += 1) { - free(e.values[i].0); - }; - free(e.values); - }, - f: func => { - type_finish(f.result); - for (let i = 0z; i < len(f.params); i += 1) { - type_finish(f.params[i]); - }; - free(f.params); - }, + e: _enum => free(e.values), + f: func => free(f.params), pointer => void, - s: slice => type_finish(s), + s: slice => void, st: _struct => free(st.fields), tu: tuple => free(tu), ta: tagged => free(ta),