diff options
| author | 2025-09-09 17:30:42 +0200 | |
|---|---|---|
| committer | 2025-09-09 17:30:42 +0200 | |
| commit | 9e787ddc2e6d6882776b015bcd561f1e23b9c1ee (patch) | |
| tree | 3a49e86c2ab2688f7df9470915e740f3b6aef685 /c.c | |
| parent | 9e383d25b6ce81c37206cdd98e0d0553a1dcc9d6 (diff) | |
ccomp: fix memory leak with temporary arena parsing for stmt
Diffstat (limited to 'c.c')
| -rw-r--r-- | c.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -2925,6 +2925,7 @@ stmt(struct comp *cm, struct function *fn) struct arena a; char mem[sizeof(struct arena) + sizeof(struct expr)*4]; } atmp = { .a.cap = sizeof(struct expr)*4 }; + struct arena *atmpp; struct expr ex; struct env e; union ref r; @@ -3110,6 +3111,7 @@ stmt(struct comp *cm, struct function *fn) struct arena *tmp = cm->exarena; cm->exarena = &atmp.a; ex = commaexpr(cm); + atmpp = cm->exarena; cm->exarena = tmp; end = newblk(fn); @@ -3124,7 +3126,7 @@ stmt(struct comp *cm, struct function *fn) useblk(fn, end); expreffects(fn, &ex); putbranch(fn, begin); - freearena(&atmp.a); + freearena(atmpp); } else if (!terminates) putbranch(fn, begin); useblk(fn, fl); } |