[tracker/wip/carlosg/coverity-fixes: 1/16] tracker: Check return value of g_file_get_contents




commit a8b01f9cd84051ae8bce8c8f76d075b1dc8de4eb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Oct 23 11:43:28 2021 +0200

    tracker: Check return value of g_file_get_contents
    
    CID: #1501126

 src/tracker/tracker-sql.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker/tracker-sql.c b/src/tracker/tracker-sql.c
index 6204dfe4f..e02ba6fb2 100644
--- a/src/tracker/tracker-sql.c
+++ b/src/tracker/tracker-sql.c
@@ -75,8 +75,8 @@ sql_by_file (void)
                return EXIT_FAILURE;
        }
 
-       g_file_get_contents (path_in_utf8, &query, &size, &error);
-       if (error) {
+       if (!g_file_get_contents (path_in_utf8, &query, &size, &error)) {
+               g_assert (error != NULL);
                g_printerr ("%s:'%s', %s\n",
                            _("Could not read file"),
                            path_in_utf8,


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