[gthumb] free the image data if the operation is cancelled



commit c586f7b41693280d312a2e78b0a3fa72b360a9d4
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Dec 22 16:16:19 2014 +0100

    free the image data if the operation is cancelled

 .../file_tools/gth-file-tool-adjust-contrast.c     |    5 ++++-
 extensions/file_tools/gth-file-tool-grayscale.c    |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/extensions/file_tools/gth-file-tool-adjust-contrast.c 
b/extensions/file_tools/gth-file-tool-adjust-contrast.c
index b89844e..1c6c034 100644
--- a/extensions/file_tools/gth-file-tool-adjust-contrast.c
+++ b/extensions/file_tools/gth-file-tool-adjust-contrast.c
@@ -256,8 +256,11 @@ adjust_contrast_exec (GthAsyncTask *task,
        p_destination_line = _cairo_image_surface_flush_and_get_data (destination);
        for (y = 0; y < height; y++) {
                gth_async_task_get_data (task, NULL, &cancelled, NULL);
-               if (cancelled)
+               if (cancelled) {
+                       cairo_surface_destroy (destination);
+                       cairo_surface_destroy (source);
                        return NULL;
+               }
 
                progress = (double) y / height;
                gth_async_task_set_data (task, NULL, NULL, &progress);
diff --git a/extensions/file_tools/gth-file-tool-grayscale.c b/extensions/file_tools/gth-file-tool-grayscale.c
index d75c0f0..ea26c94 100644
--- a/extensions/file_tools/gth-file-tool-grayscale.c
+++ b/extensions/file_tools/gth-file-tool-grayscale.c
@@ -103,8 +103,11 @@ grayscale_exec (GthAsyncTask *task,
        p_destination_line = _cairo_image_surface_flush_and_get_data (destination);
        for (y = 0; y < height; y++) {
                gth_async_task_get_data (task, NULL, &cancelled, NULL);
-               if (cancelled)
+               if (cancelled) {
+                       cairo_surface_destroy (destination);
+                       cairo_surface_destroy (source);
                        return NULL;
+               }
 
                progress = (double) y / height;
                gth_async_task_set_data (task, NULL, NULL, &progress);


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