[gnumeric] mps: fix crash on parse errors.



commit 494b275196b58c5faa0341cd739b842f31fe9f15
Author: Morten Welinder <terra gnome org>
Date:   Wed Oct 28 18:52:40 2009 -0400

    mps: fix crash on parse errors.

 plugins/mps/mps.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/plugins/mps/mps.c b/plugins/mps/mps.c
index b9f0e75..7908d70 100644
--- a/plugins/mps/mps.c
+++ b/plugins/mps/mps.c
@@ -612,10 +612,12 @@ 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;
+	if (ctxt->matrix) {
+		for (i = 0; i < ctxt->n_rows + ctxt->n_bounds; i++)
+			g_free (ctxt->matrix[i]);
+		g_free (ctxt->matrix);
+		ctxt->matrix = NULL;
+	}
 
 	g_free (ctxt->name);
 	g_object_unref (G_OBJECT (ctxt->input)); ctxt->input = NULL;



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