[tracker/wip/carlosg/coverity-warnings: 18/18] libtracker-data: Reorder unref call




commit 16e22cd3c59e8ae2fad6a2e291607ec1fdb065b3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Mar 20 13:47:03 2021 +0100

    libtracker-data: Reorder unref call
    
    The add_literal_binding() above keeps a ref to it, so it's not
    really used after free, but should help both Coverity and the
    casual reader.
    
    CID: #1501108

 src/libtracker-data/tracker-sparql.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 7d066f980..fd9ca99dc 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -1627,7 +1627,6 @@ _add_quad (TrackerSparql  *sparql,
                        tracker_binding_set_db_column_name (binding, "fts5");
                        tracker_select_context_add_literal_binding (TRACKER_SELECT_CONTEXT (sparql->context),
                                                                    TRACKER_LITERAL_BINDING (binding));
-                       g_object_unref (binding);
 
                        fts_table = tracker_sparql_add_fts_subquery (sparql, graph, subject,
                                                                     TRACKER_LITERAL_BINDING (binding));
@@ -1635,6 +1634,7 @@ _add_quad (TrackerSparql  *sparql,
                        db_table = fts_table;
                        share_table = FALSE;
                        is_fts = TRUE;
+                       g_object_unref (binding);
                } else if (property != NULL) {
                        db_table = tracker_property_get_table_name (property);
 


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