[tracker/wip/carlosg/coverity-fixes: 2/7] libtracker-data: Ensure there is an error on all failure paths




commit 2a6c761756950eca47948c5005f4ff6665ed83e4
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 7 18:06:57 2020 +0200

    libtracker-data: Ensure there is an error on all failure paths
    
    The services virtual table filter() function implementation was missing
    a GError in some failure paths. Spotted by Coverity.
    
    CID: #1491444

 src/libtracker-data/tracker-vtab-service.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-data/tracker-vtab-service.c b/src/libtracker-data/tracker-vtab-service.c
index eac11d8b6..a14d50509 100644
--- a/src/libtracker-data/tracker-vtab-service.c
+++ b/src/libtracker-data/tracker-vtab-service.c
@@ -337,8 +337,21 @@ service_filter (sqlite3_vtab_cursor  *vtab_cursor,
                }
        }
 
-       if (!cursor->service || !cursor->query)
+       if (!cursor->service) {
+               g_set_error (&error,
+                            TRACKER_SPARQL_ERROR,
+                            TRACKER_SPARQL_ERROR_PARSE,
+                            "Service not given to services virtual table");
                goto fail;
+       }
+
+       if (!cursor->query) {
+               g_set_error (&error,
+                            TRACKER_SPARQL_ERROR,
+                            TRACKER_SPARQL_ERROR_PARSE,
+                            "Query not given to services virtual table");
+               goto fail;
+       }
 
        connection = g_hash_table_lookup (cursor->vtab->cached_connections,
                                          cursor->service);


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