changeset 88:1a1fdfe860d0

Fixed several memory leaks revealed by valgrind
author lost@l-w.ca
date Wed, 22 Jun 2011 18:57:42 -0600
parents b5785eb3441f
children 651b85a98c1b
files lwasm/pseudo.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
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;
 }