[tracker-miners/wip/carlosg/coverity-fixes: 6/16] tracker-extract: Initialize variable properly




commit f148d2db440ed88afd119bd78c5c319ebf5ab3e5
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Sep 7 18:30:41 2020 +0200

    tracker-extract: Initialize variable properly
    
    The GString goes uninitialized in the (unused) helper function reading
    from streams. Spotted by Coverity.
    
    CID: #354745, #354743

 src/tracker-extract/tracker-read.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/tracker-extract/tracker-read.c b/src/tracker-extract/tracker-read.c
index da8540bfa..21fc1656f 100644
--- a/src/tracker-extract/tracker-read.c
+++ b/src/tracker-extract/tracker-read.c
@@ -290,6 +290,9 @@ tracker_read_text_from_stream (GInputStream *stream,
                        break;
                }
 
+               if (!s)
+                       s = g_string_new (NULL);
+
                /* Process read bytes, and halt loop if needed */
                if (!process_chunk (buf,
                                    n_bytes_read,


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