diff lwlib/lw_expr.c @ 92:19ca3108a223

Fixed numerous *common* memory leaks in epxression code
author lost@l-w.ca
date Wed, 22 Jun 2011 19:13:06 -0600
parents b5785eb3441f
children db5690682eb7
line wrap: on
line diff
--- a/lwlib/lw_expr.c	Wed Jun 22 19:06:14 2011 -0600
+++ b/lwlib/lw_expr.c	Wed Jun 22 19:13:06 2011 -0600
@@ -575,7 +575,10 @@
 				E -> value2 = lw_strdup(te -> value2);
 			for (o = te -> operands; o; o = o -> next)
 			{
-				lw_expr_add_operand(E, lw_expr_copy(o -> p));
+				lw_expr_t xxx;
+				xxx = lw_expr_copy(o -> p);
+				lw_expr_add_operand(E, xxx);
+				lw_expr_destroy(xxx);
 			}
 			lw_expr_destroy(te);
 			goto again;
@@ -932,6 +935,7 @@
 				lw_free(o);
 			}
 			*E = *r;
+			lw_free(r);
 			return;
 		}
 		else if (c == 0)
@@ -1003,6 +1007,7 @@
 					{
 						t1 = lw_expr_build(lw_expr_type_oper, lw_expr_oper_times, E3, o -> p);
 						lw_expr_add_operand(E, t1);
+						lw_expr_destroy(t1);
 					}
 					
 					lw_expr_destroy(E2);