diff lwasm/pseudo.c @ 88:1a1fdfe860d0

Fixed several memory leaks revealed by valgrind
author lost@l-w.ca
date Wed, 22 Jun 2011 18:57:42 -0600
parents 16a72d9b6eb6
children 5bf9edabd661
line wrap: on
line diff
--- a/lwasm/pseudo.c	Wed Jun 22 18:39:32 2011 -0600
+++ b/lwasm/pseudo.c	Wed Jun 22 18:57:42 2011 -0600
@@ -762,6 +762,7 @@
 	register_symbol(as, l, l -> sym, e, symbol_flag_none);
 	l -> symset = 1;
 	l -> dptr = lookup_symbol(as, l, l -> sym);
+	lw_expr_destroy(e);
 }
 
 PARSEFUNC(pseudo_parse_set)
@@ -786,6 +787,7 @@
 	register_symbol(as, l, l -> sym, e, symbol_flag_set);
 	l -> symset = 1;
 	l -> dptr = lookup_symbol(as, l, l -> sym);
+	lw_expr_destroy(e);
 }
 
 PARSEFUNC(pseudo_parse_setdp)
@@ -812,9 +814,11 @@
 	if (!lw_expr_istype(e, lw_expr_type_int))
 	{
 		lwasm_register_error(as, l, "SETDP must be constant on pass 1");
+		lw_expr_destroy(e);
 		return;
 	}
 	l -> dpval = lw_expr_intval(e) & 0xff;
+	lw_expr_destroy(e);
 	l -> dshow = l -> dpval;
 	l -> dsize = 1;
 }