[tracker-miners/wip/carlosg/fix-leaks: 4/5] libtracker-miner: Make GFileInfo a g_autoptr to plug leak




commit 0eb43c6069c8b19419498d0bc5c456545c97b84d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Dec 5 12:35:10 2021 +0100

    libtracker-miner: Make GFileInfo a g_autoptr to plug leak
    
    In some paths we get a NULL file info, thus query one in place,
    in that case the GFileInfo is being leaked. Since this function
    has so many return paths, it is significantly more convenient to
    make it a g_autoptr, so it's ensured to be always freed after
    exit.

 src/libtracker-miner/tracker-indexing-tree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-miner/tracker-indexing-tree.c b/src/libtracker-miner/tracker-indexing-tree.c
index b72168d02..e653f30ac 100644
--- a/src/libtracker-miner/tracker-indexing-tree.c
+++ b/src/libtracker-miner/tracker-indexing-tree.c
@@ -844,10 +844,11 @@ indexing_tree_file_is_filtered (TrackerIndexingTree *tree,
 gboolean
 tracker_indexing_tree_file_is_indexable (TrackerIndexingTree *tree,
                                          GFile               *file,
-                                         GFileInfo           *info)
+                                         GFileInfo           *file_info)
 {
        TrackerFilterType filter;
        TrackerDirectoryFlags config_flags;
+       g_autoptr (GFileInfo) info = NULL;
        GFile *config_file;
        GFileType file_type;
 
@@ -860,6 +861,8 @@ tracker_indexing_tree_file_is_indexable (TrackerIndexingTree *tree,
                return FALSE;
        }
 
+       g_set_object (&info, file_info);
+
        if (info == NULL) {
                info = g_file_query_info (file,
                                          G_FILE_ATTRIBUTE_STANDARD_TYPE ","


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