scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 369c0899dae84b514d1ef70d6a69bd09fa3557d2
parent 2cc10bb10f465b64b0dfcbf34a17d0c55a099b2b
Author: Quentin Rameau <quinq@fifth.space>
Date:   Thu,  2 Jun 2016 19:13:39 +0200

[driver] fix double free in cleanup() with multiple sources

Diffstat:
driver/posix/scc.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/driver/posix/scc.c b/driver/posix/scc.c @@ -52,9 +52,12 @@ cleanup(void) int i; for (i = 0; i < NR_TOOLS; ++i) { - if (i > failedtool && outfiles[i]) - unlink(outfiles[i]); - free(outfiles[i]); + if (outfiles[i]) { + if (i > failedtool) + unlink(outfiles[i]); + free(outfiles[i]); + outfiles[i] = NULL; + } } }