[gthumb] fixed a few memory leakes



commit 09d3df21097f3a8ce1a3a8412a132f64844bbe0b
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun May 30 10:28:31 2021 +0200

    fixed a few memory leakes

 extensions/catalogs/gth-catalog.c | 1 +
 gthumb/gio-utils.c                | 2 ++
 gthumb/gth-file-list.c            | 2 ++
 gthumb/gth-file-source-vfs.c      | 3 +++
 gthumb/gth-thumb-loader.c         | 6 +++++-
 5 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/extensions/catalogs/gth-catalog.c b/extensions/catalogs/gth-catalog.c
index bccc6131..51674f8b 100644
--- a/extensions/catalogs/gth-catalog.c
+++ b/extensions/catalogs/gth-catalog.c
@@ -724,6 +724,7 @@ gth_catalog_file_to_gio_file (GFile *file)
                g_object_unref (base);
        }
 
+       _g_uri_parts_clear (&file_parts);
        g_free (uri);
 
        return gio_file;
diff --git a/gthumb/gio-utils.c b/gthumb/gio-utils.c
index fa1c7eda..73f13c5a 100644
--- a/gthumb/gio-utils.c
+++ b/gthumb/gio-utils.c
@@ -2435,6 +2435,8 @@ _g_file_get_info_for_display (GFile *file)
                g_free (name);
        }
 
+       _g_object_unref (file_source);
+
        return file_info;
 }
 
diff --git a/gthumb/gth-file-list.c b/gthumb/gth-file-list.c
index 4d1f5c3c..0175d937 100644
--- a/gthumb/gth-file-list.c
+++ b/gthumb/gth-file-list.c
@@ -1526,6 +1526,7 @@ _gth_file_list_thumbnailer_iterate (GthFileList *file_list,
                            && can_create_file_thumbnail (file_data, current_time, young_file_found))
                        {
                                /* found a thumbnail to load */
+                               g_object_unref (file_data);
                                return FALSE;
                        }
 
@@ -1577,6 +1578,7 @@ _gth_file_list_thumbnailer_iterate (GthFileList *file_list,
                            && can_create_file_thumbnail (file_data, current_time, young_file_found))
                        {
                                /* found a thumbnail to load */
+                               g_object_unref (file_data);
                                return FALSE;
                        }
 
diff --git a/gthumb/gth-file-source-vfs.c b/gthumb/gth-file-source-vfs.c
index 7a4d1f6a..9207586f 100644
--- a/gthumb/gth-file-source-vfs.c
+++ b/gthumb/gth-file-source-vfs.c
@@ -179,8 +179,11 @@ gth_file_source_vfs_get_entry_points (GthFileSource *file_source)
                g_file_info_set_name (info, name);
 
                list = g_list_append (list, gth_file_data_new (file, info));
+
                g_object_unref (info);
                g_object_unref (file);
+               g_free (name);
+               _g_object_unref (icon);
        }
 
        _g_object_list_unref (mounts);
diff --git a/gthumb/gth-thumb-loader.c b/gthumb/gth-thumb-loader.c
index dd37bc68..1fe0f17e 100644
--- a/gthumb/gth-thumb-loader.c
+++ b/gthumb/gth-thumb-loader.c
@@ -89,6 +89,7 @@ gth_thumb_loader_finalize (GObject *object)
        self = GTH_THUMB_LOADER (object);
        _g_object_unref (self->priv->iloader);
        _g_object_unref (self->priv->tloader);
+       _g_object_unref (self->priv->thumb_factory);
 
        G_OBJECT_CLASS (gth_thumb_loader_parent_class)->finalize (object);
 }
@@ -732,7 +733,7 @@ watch_thumbnailer_cb (GPid     pid,
                }
 
                g_task_return_error (load_data->task, g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANCELLED, 
"script cancelled"));
-
+               load_data_unref (load_data);
                return;
        }
 
@@ -752,6 +753,8 @@ watch_thumbnailer_cb (GPid     pid,
        }
        else
                failed_to_load_original_image (self, load_data);
+
+       load_data_unref (load_data);
 }
 
 
@@ -783,6 +786,7 @@ original_image_ready_cb (GObject      *source_object,
 
                if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
                        g_task_return_error (load_data->task, error);
+                       load_data_unref (load_data);
                        return;
                }
 


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