[goffice] GOFormat: plug leak.



commit b36baa60815a19d7e643fae4ad89939b09a2b972
Author: Morten Welinder <terra gnome org>
Date:   Mon Aug 23 16:24:35 2010 -0400

    GOFormat: plug leak.

 ChangeLog                 |    3 +++
 NEWS                      |    1 +
 goffice/utils/go-format.c |    4 ++++
 3 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ac570b3..84b311c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-08-23  Morten Welinder  <terra gnome org>
 
+	* goffice/utils/go-format.c (go_format_parse_sequential): Plug
+	leak.
+
 	* goffice/goffice.c (libgoffice_shutdown): Free locale vars too.
 	* goffice/utils/go-locale.c (_go_locale_shutdown): New function.
 
diff --git a/NEWS b/NEWS
index a20858c..ac25ece 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Jean:
 Morten:
 	* Limit formats to sane number of decimals.  [#627066]
 	* Fix minor go_string_replace issue.
+	* Plug leaks.
 
 --------------------------------------------------------------------------
 goffice 0.8.9:
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 2e9008d..6cdc8ec 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -1238,6 +1238,7 @@ go_format_parse_sequential (const char *str, GString *prg,
 	gboolean date_ybm = FALSE;
 	gboolean date_mbd = FALSE;
 	gboolean date_dbm = FALSE;
+	gboolean prg_was_null = (prg == NULL);
 
 	if (!prg)
 		prg = g_string_new (NULL);
@@ -1495,6 +1496,9 @@ go_format_parse_sequential (const char *str, GString *prg,
 	}
 
  error:
+	if (prg_was_null)
+		g_string_free (prg, TRUE);
+
 	return NULL;
 }
 



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