[gnumeric] Solver: plug leaks.



commit f6a46a235bc0c69b7993102545f4fc5931dd9fde
Author: Morten Welinder <terra gnome org>
Date:   Tue Oct 27 20:10:47 2009 -0400

    Solver: plug leaks.

 NEWS                       |    1 +
 plugins/mps/ChangeLog      |    5 +++++
 plugins/mps/mps.c          |    4 ++++
 src/tools/solver/ChangeLog |    5 +++++
 src/tools/solver/solver.c  |    4 ++++
 5 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 204291b..9998637 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@ Morten:
 	* Fix Alt-Enter problems.  [#597295]
 	* Make DATE work for pre-1900 dates.  [#599365]
 	* Add lpsolve output format.
+	* Plug solver leaks.
 
 Yaacov Zamir:
        * Hebrew Calendar functions.  [#153738]
diff --git a/plugins/mps/ChangeLog b/plugins/mps/ChangeLog
index 1cc33bd..6a2274a 100644
--- a/plugins/mps/ChangeLog
+++ b/plugins/mps/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-27  Morten Welinder  <terra gnome org>
+
+	* mps.c (mps_input_context_destroy, mps_write_coefficients): Plug
+	leaks.
+
 2009-10-26  Morten Welinder  <terra gnome org>
 
 	* mps.c (mps_write_coefficients): Handle large number of variables
diff --git a/plugins/mps/mps.c b/plugins/mps/mps.c
index a28e411..b9f0e75 100644
--- a/plugins/mps/mps.c
+++ b/plugins/mps/mps.c
@@ -444,6 +444,7 @@ mps_write_coefficients (MpsInputContext *ctxt, Sheet *sh,
 	cell_queue_recalc (cell);
 
 	/* Store the input cell range for the Solver dialog. */
+	g_free (param->input_entry_str);
 	param->input_entry_str = g_strdup (range_as_string (&v_range));
 }
 
@@ -565,6 +566,7 @@ static void
 mps_input_context_destroy (MpsInputContext *ctxt)
 {
         GSList *current;
+	int i;
 
 	go_io_progress_unset (ctxt->io_context);
 
@@ -610,6 +612,8 @@ mps_input_context_destroy (MpsInputContext *ctxt)
 	g_free (ctxt->col_name_tbl);
 	ctxt->col_name_tbl = NULL;
 
+	for (i = 0; i < ctxt->n_rows + ctxt->n_bounds; i++)
+		g_free (ctxt->matrix[i]);
 	g_free (ctxt->matrix);
 	ctxt->matrix = NULL;
 
diff --git a/src/tools/solver/ChangeLog b/src/tools/solver/ChangeLog
index a87fca0..a8c8980 100644
--- a/src/tools/solver/ChangeLog
+++ b/src/tools/solver/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-27  Morten Welinder  <terra gnome org>
+
+	* solver.c (solver_insert_rows, solver_insert_cols,
+	solver_delete_rows, solver_delete_cols): Plug leak.
+
 2009-10-11  Morten Welinder <terra gnome org>
 
 	* Release 1.9.14
diff --git a/src/tools/solver/solver.c b/src/tools/solver/solver.c
index 66a6d1d..b716f40 100644
--- a/src/tools/solver/solver.c
+++ b/src/tools/solver/solver.c
@@ -887,6 +887,7 @@ solver_insert_rows (Sheet *sheet, int row, int count)
 		        range.end.col   = input_range->v_range.cell.b.col;
 		        range.end.row   = input_range->v_range.cell.b.row +
 			        count;
+			g_free (param->input_entry_str);
 			param->input_entry_str =
 			        g_strdup (global_range_name (sheet, &range));
 		}
@@ -928,6 +929,7 @@ solver_insert_cols (Sheet *sheet, int col, int count)
 		range.start.row = input_range->v_range.cell.a.row;
 		range.end.col   = input_range->v_range.cell.b.col + count;
 		range.end.row   = input_range->v_range.cell.b.row;
+		g_free (param->input_entry_str);
 		param->input_entry_str = g_strdup (
 			global_range_name (sheet, &range));
 	}
@@ -968,6 +970,7 @@ solver_delete_rows (Sheet *sheet, int row, int count)
 		range.start.row = input_range->v_range.cell.a.row - count;
 		range.end.col   = input_range->v_range.cell.b.col;
 		range.end.row   = input_range->v_range.cell.b.row - count;
+		g_free (param->input_entry_str);
 		if (range.start.row < row || range.end.row < row)
 			param->input_entry_str = g_strdup ("");
 		else
@@ -1013,6 +1016,7 @@ solver_delete_cols (Sheet *sheet, int col, int count)
 		        range.end.col   = input_range->v_range.cell.b.col -
 			        count;
 		        range.end.row   = input_range->v_range.cell.b.row;
+			g_free (param->input_entry_str);
 			if (range.start.col < col || range.end.col < col)
 			        param->input_entry_str = g_strdup ("");
 			else



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