[tracker/wip/carlosg/coverity-warnings] libtracker-sparql: Fix newly introduced coverity warnings




commit b193768ab6006f37e75edf1a4f5278b2b7d113af
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Dec 13 21:41:25 2020 +0100

    libtracker-sparql: Fix newly introduced coverity warnings
    
    We shouldn't reach paths that those are unset, avoid the warning
    anyway.

 src/libtracker-sparql/tracker-serializer-json.c | 2 +-
 src/libtracker-sparql/tracker-serializer-xml.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-sparql/tracker-serializer-json.c b/src/libtracker-sparql/tracker-serializer-json.c
index 066397bba..1b0570d3a 100644
--- a/src/libtracker-sparql/tracker-serializer-json.c
+++ b/src/libtracker-sparql/tracker-serializer-json.c
@@ -137,7 +137,7 @@ serialize_up_to_position (TrackerSerializerJson  *serializer_json,
                json_builder_begin_object (builder);
 
                for (i = 0; i < tracker_sparql_cursor_get_n_columns (cursor); i++) {
-                       const gchar *var, *str, *type, *datatype = NULL;
+                       const gchar *var, *str, *type = NULL, *datatype = NULL;
 
                        if (tracker_sparql_cursor_get_value_type (cursor, i) == 
TRACKER_SPARQL_VALUE_TYPE_UNBOUND)
                                continue;
diff --git a/src/libtracker-sparql/tracker-serializer-xml.c b/src/libtracker-sparql/tracker-serializer-xml.c
index a28d48c32..1d1f5c10f 100644
--- a/src/libtracker-sparql/tracker-serializer-xml.c
+++ b/src/libtracker-sparql/tracker-serializer-xml.c
@@ -125,7 +125,7 @@ serialize_up_to_position (TrackerSerializerXml  *serializer_xml,
                xmlTextWriterStartElement (serializer_xml->writer, "result");
 
                for (i = 0; i < tracker_sparql_cursor_get_n_columns (cursor); i++) {
-                       const gchar *var, *str, *type, *datatype = NULL;
+                       const gchar *var, *str, *type = NULL, *datatype = NULL;
 
                        if (tracker_sparql_cursor_get_value_type (cursor, i) == 
TRACKER_SPARQL_VALUE_TYPE_UNBOUND)
                                continue;


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