[tracker-miners: 1/2] tracker: fix coverity warnings




commit 77ffdddd73ef6076d3aee9a44d9141e90f80526b
Author: Nishit Patel <nishitlimbani130 gmail com>
Date:   Wed Jun 16 13:44:40 2021 +0530

    tracker: fix coverity warnings
    
    Coverity warning were introduced after MR !327
    https://gitlab.gnome.org/GNOME/tracker-miners/-/merge_requests/327#note_1178664

 src/tracker/tracker-cli-utils.c | 14 ++++++++++----
 src/tracker/tracker-info.c      |  1 +
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker/tracker-cli-utils.c b/src/tracker/tracker-cli-utils.c
index e7aa1fffe..9ebab3bc8 100644
--- a/src/tracker/tracker-cli-utils.c
+++ b/src/tracker/tracker-cli-utils.c
@@ -83,15 +83,21 @@ tracker_cli_get_error_keyfiles (void)
        for (l = infos; l; l = l->next) {
                GKeyFile *keyfile;
                GFile *child;
+               GError *error = NULL;
 
                child = g_file_get_child (file, g_file_info_get_name (l->data));
                path = g_file_get_path (child);
                keyfile = g_key_file_new ();
-               g_key_file_load_from_file (keyfile,
-                                          path, 0,
-                                          NULL);
 
-               keyfiles = g_list_prepend (keyfiles, keyfile);
+               if (g_key_file_load_from_file (keyfile, path, 0, &error)) {
+                       keyfiles = g_list_prepend (keyfiles, keyfile);
+
+               } else {
+                       g_warning ("Error retrieving keyfiles: %s", error->message);
+                       g_error_free (error);
+                       g_key_file_free (keyfile);
+               }
+
                g_object_unref (child);
        }
 
diff --git a/src/tracker/tracker-info.c b/src/tracker/tracker-info.c
index d26e8abc8..14cab817a 100644
--- a/src/tracker/tracker-info.c
+++ b/src/tracker/tracker-info.c
@@ -420,6 +420,7 @@ print_errors (GList *keyfiles,
                        g_print ("\n");
 
                        g_free (message);
+                       g_free (sparql);
                }
 
                g_free (uri);


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