[goffice] GogAxis: plug leak.



commit 998921b3887ce29debed4cee7d42744246de66ea
Author: Morten Welinder <terra gnome org>
Date:   Thu Nov 3 10:24:48 2011 -0400

    GogAxis: plug leak.

 ChangeLog                |    2 ++
 goffice/graph/gog-axis.c |    8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 682adef..d63e51d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2011-11-03  Morten Welinder  <terra gnome org>
 
+	* goffice/graph/gog-axis.c (map_discrete_calc_ticks): Plug leak.
+
 	* goffice/utils/go-string.c (go_string_new_rich): Plug leak.
 
 2011-10-31  Jean Brefort  <jean brefort normalesup org>
diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index 7af2ba5..6c21ad5 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -385,7 +385,6 @@ map_discrete_calc_ticks (GogAxis *axis)
 		ticks[i].str = NULL;
 	}
 	for (i = 0, j = tick_nbr; i < label_nbr; i++, j++) {
-		char *label;
 		ticks[j].position = go_rint (label_start + (double) (i) * major_label);
 		index = ticks[j].position - 1;
 		ticks[j].type = GOG_AXIS_TICK_NONE;
@@ -394,7 +393,7 @@ map_discrete_calc_ticks (GogAxis *axis)
 			if (index < (int) go_data_get_vector_size (axis->labels) && index >= 0) {
 				PangoAttrList *l = go_data_get_vector_markup (axis->labels, index);
 				if (l != NULL) {
-					label = go_data_get_vector_string (axis->labels, index);
+					char *label = go_data_get_vector_string (axis->labels, index);
 					gog_axis_ticks_set_markup (&ticks[j], label, l);
 					g_free (label);
 				} else {
@@ -402,15 +401,16 @@ map_discrete_calc_ticks (GogAxis *axis)
 					if (go_finite (val))
 						axis_format_value (axis, val, &ticks[j].str);
 					else {
-						label = go_data_get_vector_string (axis->labels, index);
+						char *label = go_data_get_vector_string (axis->labels, index);
 						gog_axis_ticks_set_text (&ticks[j], label);
 						g_free (label);
 					}
 				}
 			}
 		} else {
-			label = g_strdup_printf ("%d", index + 1);
+			char *label = g_strdup_printf ("%d", index + 1);
 			gog_axis_ticks_set_text (&ticks[j], label);
+			g_free (label);
 		}
 	}
 



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