aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-03-07 21:12:40 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:18 +0100
commitf5e89edf69903a2c0eb2c6e7d88cdfbc5fdace92 (patch)
treed3d6f1f465cc882989813dc31f7458140e422df2
parentba75f4dcefffcfe71c1b7295e94b28f90b149d17 (diff)
hdfsee: Tidy up some memory leaks
-rw-r--r--src/dw-hdfsee.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index 7db66f86..fb6803d7 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -52,6 +52,26 @@ static gint displaywindow_closed(GtkWidget *window, DisplayWindow *dw)
hdfile_close(dw->hdfile);
}
+ if ( dw->surf != NULL ) cairo_surface_destroy(dw->surf);
+
+ if ( dw->pixbufs != NULL ) {
+ int i;
+ for ( i=0; i<dw->n_pixbufs; i++ ) {
+ gdk_pixbuf_unref(dw->pixbufs[i]);
+ }
+ free(dw->pixbufs);
+ }
+
+ if ( dw->col_scale != NULL ) {
+ gdk_pixbuf_unref(dw->col_scale);
+ }
+
+ if ( dw->image != NULL ) {
+ free(dw->image->data);
+ free(dw->image->flags);
+ free(dw->image);
+ }
+
/* Notify 'main', so it can update the master list */
hdfsee_window_closed(dw);
@@ -355,7 +375,6 @@ static int write_png(const char *filename, DisplayWindow *dw)
static gint displaywindow_close(GtkWidget *widget, DisplayWindow *dw)
{
- cairo_surface_destroy(dw->surf);
gtk_widget_destroy(dw->window);
return 0;
}