changeset 91:95181f1ad183

Really fix memory leaks
author lost@l-w.ca
date Wed, 22 Jun 2011 19:06:14 -0600
parents e20f9d59d5da
children 19ca3108a223
files lwasm/insn_indexed.c lwasm/insn_rel.c
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/insn_indexed.c	Wed Jun 22 18:58:10 2011 -0600
+++ b/lwasm/insn_indexed.c	Wed Jun 22 19:06:14 2011 -0600
@@ -363,7 +363,7 @@
 				}
 				
 				l -> pb = pb;
-//				lw_expr_destroy(e2);
+				lw_expr_destroy(e2);
 //				lw_expr_destroy(e3);
 				return;
 			}
@@ -401,6 +401,7 @@
 				}
 			
 				l -> pb = pb;
+				lw_expr_destroy(e2);
 				return;
 			}
 			else
@@ -417,10 +418,11 @@
 					pb = (l -> pb & 0x03) << 5 | (v & 0x1F);
 				}
 				l -> pb = pb;
+				lw_expr_destroy(e2);
 				return;
 			}
-			lw_expr_destroy(e2);
 		}
+		lw_expr_destroy(e2);
 	}
 		
 	if (lw_expr_istype(e, lw_expr_type_int))
--- a/lwasm/insn_rel.c	Wed Jun 22 18:58:10 2011 -0600
+++ b/lwasm/insn_rel.c	Wed Jun 22 19:06:14 2011 -0600
@@ -93,6 +93,7 @@
 	if (!t)
 	{
 		lwasm_register_error(as, l, "Bad operand");
+		lw_expr_destroy(t);
 		return;
 	}
 	l -> len = OPLEN(instab[l -> insn].ops[0]) + 2;