[tracker-miners/wip/carlosg/coverity-fixes: 21/28] cli: Check directly return value of g_key_file_load_from_file()




commit fe218c58a8ffc87d7a2073cad74423148460bde7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 24 12:08:10 2021 +0200

    cli: Check directly return value of g_key_file_load_from_file()
    
    This seems to confuse Coverity...
    
    CID: #365662

 src/tracker/tracker-miner-manager.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker/tracker-miner-manager.c b/src/tracker/tracker-miner-manager.c
index 0beca0e8d..6ac30c812 100644
--- a/src/tracker/tracker-miner-manager.c
+++ b/src/tracker/tracker-miner-manager.c
@@ -749,9 +749,9 @@ check_file (GFile    *file,
        priv = tracker_miner_manager_get_instance_private (manager);
 
        key_file = g_key_file_new ();
-       g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, &error);
 
-       if (error) {
+       if (!g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, &error)) {
+               g_assert (error != NULL);
                g_warning ("Error parsing miner .desktop file: %s", error->message);
                g_error_free (error);
                g_key_file_free (key_file);


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