[gnumeric] mps: plug leak.



commit 437b5e7da929473c26ded3ddf40d1653cac283e9
Author: Morten Welinder <terra gnome org>
Date:   Sun Nov 8 12:10:42 2009 -0500

    mps: plug leak.

 NEWS                  |    1 +
 plugins/mps/ChangeLog |    4 ++++
 plugins/mps/mps.c     |   16 ++++++++++++++--
 3 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index fca1d25..d2c2895 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Jody:
 Morten:
 	* Resurrect long-double support.
 	* More solver fixes.
+	* Plug another mps leak.
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.15
diff --git a/plugins/mps/ChangeLog b/plugins/mps/ChangeLog
index e85656f..e2c8328 100644
--- a/plugins/mps/ChangeLog
+++ b/plugins/mps/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-08  Morten Welinder  <terra gnome org>
+
+	* mps.c (mps_input_context_destroy): Plug leak.
+
 2009-11-01  Morten Welinder <terra gnome org>
 
 	* Release 1.9.15
diff --git a/plugins/mps/mps.c b/plugins/mps/mps.c
index 0956e06..0c6bab5 100644
--- a/plugins/mps/mps.c
+++ b/plugins/mps/mps.c
@@ -555,6 +555,15 @@ ch_rm_cb (gpointer key, gpointer value, gpointer user_data)
         return TRUE;
 }
 
+static void
+free_row (MpsRow *row)
+{
+	if (row) {
+		g_free (row->name);
+		g_free (row);
+	}
+}
+
 /* Free the allocated memory. */
 static void
 mps_input_context_destroy (MpsInputContext *ctxt)
@@ -564,13 +573,16 @@ mps_input_context_destroy (MpsInputContext *ctxt)
 
 	go_io_progress_unset (ctxt->io_context);
 
+	free_row (ctxt->objective_row);
+	ctxt->objective_row = NULL;
+
 	/* Free ROWS */
 	for (current = ctxt->rows; current != NULL; current = current->next) {
 	           MpsRow *row = current->data;
-		   g_free (row->name);
-		   g_free (row);
+		   free_row (row);
 	}
 	g_slist_free (ctxt->rows);
+	ctxt->rows = NULL;
 
 	/* Free COLUMNS */
 	for (current = ctxt->cols; current != NULL; current = current->next) {



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