shithub: scc

Download patch

ref: 96e6976155ca954ce9abeb308640e28901211479
parent: b00898d90c39c522aa074b10448d6c72c4176683
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Mar 20 08:58:42 EDT 2015

Fix error in imm()

imm() was reserving space for only a pointer to Symbol,
not for the symbol itself.

--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -235,7 +235,7 @@
 	np->op = CONST;
 	np->type = l_int16;
 	/* FIX: memory leak */
-	np->sym = xmalloc(sizeof(Symbol *));
+	np->sym = xmalloc(sizeof(Symbol));
 	np->sym->u.imm = i;
 	np->left = np->right = NULL;
 	return np;