changeset 438:22bbb716dea6 3.0

Fixed memory leaks related to expressions; bumped version to 3.0.1
author lost@l-w.ca
date Sat, 30 Oct 2010 10:40:26 -0600
parents 4c272633fce2
children b8549694b4c9
files configure.ac lwlib/lw_expr.c
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Fri Oct 29 19:28:54 2010 -0600
+++ b/configure.ac	Sat Oct 30 10:40:26 2010 -0600
@@ -1,4 +1,4 @@
-AC_INIT([LWTools], [3.0], [lost@l-w.ca])
+AC_INIT([LWTools], [3.0.1], [lost@l-w.ca])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 AC_PROG_CC
 gl_EARLY
--- a/lwlib/lw_expr.c	Fri Oct 29 19:28:54 2010 -0600
+++ b/lwlib/lw_expr.c	Sat Oct 30 10:40:26 2010 -0600
@@ -97,8 +97,13 @@
 	struct lw_expr_opers *o;
 	if (!E)
 		return;
-	for (o = E -> operands; o; o = o -> next)
+	while (E -> operands)
+	{
+		o = E -> operands;
+		E -> operands = o -> next;
 		lw_expr_destroy(o -> p);
+		lw_Free(o);
+	}
 	if (E -> type == lw_expr_type_var)
 		lw_free(E -> value2);
 	lw_free(E);
@@ -119,7 +124,7 @@
 		r -> value2 = lw_strdup(E -> value2);
 	for (o = E -> operands; o; o = o -> next)
 	{
-		lw_expr_add_operand(r, lw_expr_copy(o -> p));
+		lw_expr_add_operand(r, o -> p);
 	}
 	
 	return r;