shithub: scc

Download patch

ref: ee35a53bd9302e84cfe2d29f2e0919b352c478eb
parent: 07a329b7e6b3703b47b98fd6a954d68b8d36bb08
author: Quentin Rameau <quinq@fifth.space>
date: Thu Jun 2 15:13:39 EDT 2016

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

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -52,9 +52,12 @@
 	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;
+		}
 	}
 }