comparison 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
comparison
equal deleted inserted replaced
87:b5785eb3441f 88:1a1fdfe860d0
760 } 760 }
761 761
762 register_symbol(as, l, l -> sym, e, symbol_flag_none); 762 register_symbol(as, l, l -> sym, e, symbol_flag_none);
763 l -> symset = 1; 763 l -> symset = 1;
764 l -> dptr = lookup_symbol(as, l, l -> sym); 764 l -> dptr = lookup_symbol(as, l, l -> sym);
765 lw_expr_destroy(e);
765 } 766 }
766 767
767 PARSEFUNC(pseudo_parse_set) 768 PARSEFUNC(pseudo_parse_set)
768 { 769 {
769 lw_expr_t e; 770 lw_expr_t e;
784 } 785 }
785 786
786 register_symbol(as, l, l -> sym, e, symbol_flag_set); 787 register_symbol(as, l, l -> sym, e, symbol_flag_set);
787 l -> symset = 1; 788 l -> symset = 1;
788 l -> dptr = lookup_symbol(as, l, l -> sym); 789 l -> dptr = lookup_symbol(as, l, l -> sym);
790 lw_expr_destroy(e);
789 } 791 }
790 792
791 PARSEFUNC(pseudo_parse_setdp) 793 PARSEFUNC(pseudo_parse_setdp)
792 { 794 {
793 lw_expr_t e; 795 lw_expr_t e;
810 // try simplifying the expression and see if it turns into an int 812 // try simplifying the expression and see if it turns into an int
811 lwasm_reduce_expr(as, e); 813 lwasm_reduce_expr(as, e);
812 if (!lw_expr_istype(e, lw_expr_type_int)) 814 if (!lw_expr_istype(e, lw_expr_type_int))
813 { 815 {
814 lwasm_register_error(as, l, "SETDP must be constant on pass 1"); 816 lwasm_register_error(as, l, "SETDP must be constant on pass 1");
817 lw_expr_destroy(e);
815 return; 818 return;
816 } 819 }
817 l -> dpval = lw_expr_intval(e) & 0xff; 820 l -> dpval = lw_expr_intval(e) & 0xff;
821 lw_expr_destroy(e);
818 l -> dshow = l -> dpval; 822 l -> dshow = l -> dpval;
819 l -> dsize = 1; 823 l -> dsize = 1;
820 } 824 }
821 825
822 PARSEFUNC(pseudo_parse_ifp1) 826 PARSEFUNC(pseudo_parse_ifp1)