[tracker-miners/wip/carlosg/leak-fixes: 5/5] libtracker-miner: Plug leak




commit 351bc6b5b8c70770883d80095ad894918fca7157
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Aug 5 12:16:01 2020 +0200

    libtracker-miner: Plug leak
    
    At the time of iterating through directories left to be crawled in an
    index root, the directories themselves were being leaked. Use
    g_set_object() to ensure the old ref is removed, and compensate for the
    ref the function now keeps.

 src/libtracker-miner/tracker-file-notifier.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 8786f35b1..ca964b718 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -520,7 +520,7 @@ crawl_directory_in_current_root (TrackerFileNotifier *notifier)
                TrackerDirectoryFlags flags;
 
                directory = g_queue_pop_head (priv->current_index_root->pending_dirs);
-               priv->current_index_root->current_dir = directory;
+               g_set_object (&priv->current_index_root->current_dir, directory);
 
                tracker_indexing_tree_get_root (priv->indexing_tree,
                                                directory, &flags);
@@ -541,6 +541,7 @@ crawl_directory_in_current_root (TrackerFileNotifier *notifier)
                if (tracker_crawler_start (priv->crawler,
                                           directory,
                                           priv->current_index_root->flags)) {
+                       g_object_unref (directory);
                        return TRUE;
                }
 


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