[goffice] Fixed memory issues.



commit 57262cf6f80e9e948bf655c299e14792ef84f79b
Author: Jean Brefort <jean brefort normalesup org>
Date:   Wed Nov 10 17:09:45 2010 +0100

    Fixed memory issues.

 ChangeLog                            |    7 +++++++
 plugins/plot_distrib/gog-histogram.c |    7 ++-----
 plugins/plot_surface/gog-contour.c   |    2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index facdafc..03097cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-11-10  Jean Brefort  <jean brefort normalesup org>
+
+	* plugins/plot_distrib/gog-histogram.c
+	(gog_histogram_plot_series_update): fixed memory errors.
+	* plugins/plot_surface/gog-contour.c
+	(gog_contour_plot_foreach_elem): ditto.
+
 2010-11-04  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/graph/gog-chart-map.c (make_path_cspline): fixed an infinite loop
diff --git a/plugins/plot_distrib/gog-histogram.c b/plugins/plot_distrib/gog-histogram.c
index 3a0ba38..b03775d 100644
--- a/plugins/plot_distrib/gog-histogram.c
+++ b/plugins/plot_distrib/gog-histogram.c
@@ -1008,13 +1008,10 @@ gog_histogram_plot_series_update (GogObject *obj)
 		if (x_len > 1) {
 			series->real_y = g_new0 (double, x_len - 1);
 			for (i = 0; i < y_len && y[i] <= series->real_x[0]; i++);
-			for (max = 1;  i < y_len; i++)
+			for (max = 1; i < y_len; i++)
 				if (go_finite (y[i])) {
-					while (y[i] > series->real_x[max]) {
+					while (max < x_len - 1 && y[i] > series->real_x[max])
 						max++;
-						if (max == x_len - 1)
-							break;
-					}
 					series->real_y[max-1]++;
 			}
 			if (y__len > 0) {
diff --git a/plugins/plot_surface/gog-contour.c b/plugins/plot_surface/gog-contour.c
index ed6ce2f..bec54df 100644
--- a/plugins/plot_surface/gog-contour.c
+++ b/plugins/plot_surface/gog-contour.c
@@ -157,7 +157,7 @@ gog_contour_plot_foreach_elem  (GogPlot *plot, gboolean only_visible,
 	for (; i < nticks; i++)
 		if (zticks[i].type == GOG_AXIS_TICK_MAJOR)
 			limits[j++] = zticks[i].position;
-	if (maximum > limits[j])
+	if (maximum > limits[j - 1])
 		limits[j] = maximum;
 	else
 		j--;



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