[goffice] Fixed some memory leaks.



commit 85eb778ff83922b2e40d1ad9ea010411e8b8a2f7
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Aug 15 09:34:58 2013 +0200

    Fixed some memory leaks.

 ChangeLog                      |    5 +++++
 plugins/plot_surface/gog-xyz.c |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f3490ed..6f0bcfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-15  Jean Brefort  <jean brefort normalesup org>
+
+       * plugins/plot_surface/gog-xyz.c (gog_xyz_plot_update_3d),
+       (gog_xyz_plot_get_x_vals), (gog_xyz_plot_get_y_vals): fixed memory leaks.
+
 2013-08-14  Jean Brefort  <jean brefort normalesup org>
 
        * plugins/plot_surface/gog-contour.c (gog_contour_view_render): don't crash
diff --git a/plugins/plot_surface/gog-xyz.c b/plugins/plot_surface/gog-xyz.c
index e546bd1..4848682 100644
--- a/plugins/plot_surface/gog-xyz.c
+++ b/plugins/plot_surface/gog-xyz.c
@@ -77,6 +77,7 @@ gog_xyz_plot_update_3d (GogPlot *plot)
        if (plot->series == NULL)
                return;
 
+       g_free (xyz->plotted_data);
        xyz->plotted_data = gog_xyz_plot_build_matrix (xyz, &cardinality_changed);
        if (cardinality_changed) {
                /*      gog_plot_request_cardinality_update can't be called from here
@@ -122,7 +123,7 @@ gog_xyz_plot_get_x_vals (GogXYZPlot *plot)
                        vals = g_new (double, imax);
                        for (i = 0; i < imax; ++i)
                                vals[i] = plot->x.minima + i * inc;
-                       plot->x_vals = GO_DATA (go_data_vector_val_new (vals, imax, NULL));
+                       plot->x_vals = GO_DATA (go_data_vector_val_new (vals, imax, g_free));
                }
                return plot->x_vals;
        } else {
@@ -146,7 +147,7 @@ gog_xyz_plot_get_y_vals (GogXYZPlot *plot)
                        vals = g_new (double, imax);
                        for (i = 0; i < imax; ++i)
                                vals[i] = plot->y.minima + i * inc;
-                       plot->y_vals = GO_DATA (go_data_vector_val_new (vals, imax, NULL));
+                       plot->y_vals = GO_DATA (go_data_vector_val_new (vals, imax, g_free));
                }
                return plot->y_vals;
        } else {


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