diff options
| author | 2025-12-14 21:57:07 +0100 | |
|---|---|---|
| committer | 2025-12-14 21:57:07 +0100 | |
| commit | 437aff64992eb8a8d31360d1f9c656831b838679 (patch) | |
| tree | fcfe220eddd63189f253f3810b1f9166598f4e0b /c/c.c | |
| parent | 450869ce81b72c7380b4c83149fb39f9f66f28dc (diff) | |
c: fix another memory-leak-when-errors case
Diffstat (limited to 'c/c.c')
| -rw-r--r-- | c/c.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -4015,6 +4015,7 @@ stmt(struct comp *cm, struct function *fn) useblk(fn, tr); } } + atmpp = NULL; if (!match(cm, NULL, ')')) { /* iter */ /* since exarena is free'd at the end of each stmt, create a new temporary * arena to parse this expression because loop body statements would free it @@ -4037,7 +4038,6 @@ stmt(struct comp *cm, struct function *fn) useblk(fn, end); expreffects(fn, &ex); putbranch(fn, begin); - freearena(&atmpp); } else if (!terminates) putbranch(fn, begin); if (fl->npred > 0) { useblk(fn, fl); @@ -4046,6 +4046,7 @@ stmt(struct comp *cm, struct function *fn) terminates = 1; } } + if (atmpp && atmpp != cm->exarena) freearena(&atmpp); envup(cm); break; case TKWswitch: |