[tracker-miners/wip/carlosg/coverity-fixes: 13/28] tracker-miner-fs: Plug leak




commit 54885d2df4e7f33af01719ac79479b3627595f46
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 24 00:44:47 2021 +0200

    tracker-miner-fs: Plug leak
    
    The initial empty string is being overwritten if delete_self is
    true.
    
    CID: #365660

 src/miners/fs/tracker-miner-files.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index acf3aecdb..aad42354f 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -2301,8 +2301,6 @@ add_delete_sparql (GFile               *file,
 
        uri = g_file_get_uri (file);
 
-       sparql = g_string_new (NULL);
-
        if (delete_children) {
                sparql = g_string_new ("DELETE { "
                                       "  GRAPH " DEFAULT_GRAPH " {"
@@ -2326,6 +2324,8 @@ add_delete_sparql (GFile               *file,
                g_string_append_printf (sparql, "STRSTARTS (?u, \"%s/\")", uri);
 
                g_string_append (sparql, ")}");
+       } else {
+               sparql = g_string_new (NULL);
        }
 
        if (delete_self) {


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