diff options
| author | 2022-08-19 12:33:38 +0200 | |
|---|---|---|
| committer | 2022-08-19 12:33:38 +0200 | |
| commit | 29bc8fb426efabd942d229dc08b32e27bc925cb0 (patch) | |
| tree | fd2708783df45f4401bc42a50e33306dce4e4c7f /src | |
| parent | 87ee8d01a7e8a19461d712c7acd3e2050ccf3ffc (diff) | |
fix leaks
Diffstat (limited to 'src')
| -rw-r--r-- | src/parse.cff | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/parse.cff b/src/parse.cff index 1125f37..e237a90 100644 --- a/src/parse.cff +++ b/src/parse.cff @@ -810,7 +810,7 @@ fn parseexpandtepl(P *Parser, tepl *Tepl) *const Type { let loc = container_of(tepl, Decl, u.Tepl).loc; while !lexmatch(P, &tok, '>') { let par = &tepl.params[i]; - let toks [#]Tok = (as(*Tok)xcalloc(sizeof Tok, 1))[0::1]; + let toks [#]Tok = (as(*Tok)P.alloc->alloc(sizeof Tok, alignof Tok))[0::1]; switch par.u { case Ty; toks[0] = { :typearg, P.curloc, parsetype(P), .u: { .ident: par.name }}; @@ -895,6 +895,7 @@ fn parseexpandtepl(P *Parser, tepl *Tepl) *const Type { } } } + free(args); free(tpargs.#ptr); return cache.ty; } @@ -909,7 +910,7 @@ fn parseexpandtepl(P *Parser, tepl *Tepl) *const Type { } envfree(env); (as(*Type)ty).u.Agg.tpargs = tpargs; - cache = xcalloc(sizeof(*cache), 1); + cache = P.alloc->alloc(sizeof(*cache), alignof(*cache)); cache.next = tepl.cache; cache.args = tpargs; cache.ty = ty; |