[gnumeric] plug leaks.



commit a170475ba8591f6fb9865b8f57fef93605a65641
Author: Morten Welinder <terra gnome org>
Date:   Thu Aug 12 09:51:41 2010 -0400

    plug leaks.

 ChangeLog  |    5 +++++
 src/cell.c |   10 ++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4651745..a171d0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-12  Morten Welinder  <terra gnome org>
+
+	* src/cell.c (gnm_cell_set_expr_and_value, gnm_cell_set_value):
+	Plug leaks in case preconditions fail.
+
 2010-08-12  Jean Brefort  <jean brefort normalesup org>
 
 	* src/item-edit.c (item_edit_update_bounds): fix in-cell editing when
diff --git a/src/cell.c b/src/cell.c
index 35b5201..6bd79d3 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -151,7 +151,10 @@ gnm_cell_set_value (GnmCell *cell, GnmValue *v)
 {
 	g_return_if_fail (cell != NULL);
 	g_return_if_fail (v != NULL);
-	g_return_if_fail (!gnm_cell_is_nonsingleton_array (cell));
+	if (gnm_cell_is_nonsingleton_array (cell)) {
+		value_release (v);
+		g_return_if_fail (!gnm_cell_is_nonsingleton_array (cell));
+	}
 
 	gnm_cell_cleanout (cell);
 	cell->value = v;
@@ -175,7 +178,10 @@ gnm_cell_set_expr_and_value (GnmCell *cell, GnmExprTop const *texpr, GnmValue *v
 {
 	g_return_if_fail (cell != NULL);
 	g_return_if_fail (texpr != NULL);
-	g_return_if_fail (!gnm_cell_is_nonsingleton_array (cell));
+	if (gnm_cell_is_nonsingleton_array (cell)) {
+		value_release (v);
+		g_return_if_fail (!gnm_cell_is_nonsingleton_array (cell));
+	}
 
 	/* Repeat after me.  Ref before unref. */
 	gnm_expr_top_ref (texpr);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]