diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-03-07 21:12:40 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:18 +0100 |
commit | f5e89edf69903a2c0eb2c6e7d88cdfbc5fdace92 (patch) | |
tree | d3d6f1f465cc882989813dc31f7458140e422df2 /src/dw-hdfsee.c | |
parent | ba75f4dcefffcfe71c1b7295e94b28f90b149d17 (diff) |
hdfsee: Tidy up some memory leaks
Diffstat (limited to 'src/dw-hdfsee.c')
-rw-r--r-- | src/dw-hdfsee.c | 21 |
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; } |