[tracker-miners/wip/carlosg/coverity-fixes: 27/28] tracker-writeback: Fix use after free




commit ffc9be832a92ea570605a335655f32cac2eb385b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 24 12:55:35 2021 +0200

    tracker-writeback: Fix use after free
    
    In this error condition, the uri variable was still being used
    after being freed.
    
    CID: #365661

 src/tracker-writeback/tracker-writeback-file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/tracker-writeback/tracker-writeback-file.c b/src/tracker-writeback/tracker-writeback-file.c
index b6d1be582..49bea7bc1 100644
--- a/src/tracker-writeback/tracker-writeback-file.c
+++ b/src/tracker-writeback/tracker-writeback-file.c
@@ -67,13 +67,13 @@ create_temporary_file (GFile      *file,
 
                uri = g_file_get_uri (file);
                g_warning ("Could not create temporary file, file is not native: '%s'", uri);
-               g_free (uri);
 
                g_set_error (in_error,
                             G_IO_ERROR,
                             G_IO_ERROR_FAILED,
                             "Could not create temporary file, file is not native: '%s'",
                             uri);
+               g_free (uri);
 
                return NULL;
        }


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