shithub: scc

Download patch

ref: 8105290a1e8cc4bda9b9bb7e9583b9282fcb1cb1
parent: c43561c89b53aa1ccd0d98acd400ad059ab99fb0
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Nov 13 03:18:32 EST 2021

cc1: Fix double free() error

The commit e8a346f9 tried to fix the double free() error
detected using stress testing. The problem with that solution
was that it could not work with macro expansion because it
only concatenated consecutive strings, but it didn't considered
strings resulting of macro expansion.

--- a/src/cmd/cc/cc1/expr.c
+++ b/src/cmd/cc/cc1/expr.c
@@ -607,7 +607,6 @@
 		s = xrealloc(s, len + n + 1);
 		memcpy(s+len, t, n);
 		s[len + n] = '\0';
-		killsym(yylval.sym);
 	}
 	++len;
 	if (tp->n.elem != len) {