Blame SOURCES/0006-tree-cleanup-non-fatal-errors-in-load_key_info.patch

4c949f
From d5fbca9987b595c3f277a39cc04aca810bde02bc Mon Sep 17 00:00:00 2001
4c949f
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
4c949f
Date: Mon, 10 Dec 2018 15:46:17 +0100
4c949f
Subject: [PATCH] tree: cleanup non-fatal errors in load_key_info()
4c949f
MIME-Version: 1.0
4c949f
Content-Type: text/plain; charset=UTF-8
4c949f
Content-Transfer-Encoding: 8bit
4c949f
4c949f
There are errors which are not fatal and just ignored in load_keyinfo.
4c949f
However, as those have not been cleaned up, we could see messages like:
4c949f
(lt-osinfo-detect:20658): GLib-WARNING **: GError set over the top of a
4c949f
previous GError or uninitialized memory.
4c949f
This indicates a bug in someone's code. You must ensure an error is NULL
4c949f
before it's set.
4c949f
The overwriting error message was: Key file does not have key “boot.iso”
4c949f
in group “images-x86_64”
4c949f
4c949f
In order to avoid this, let's just call g_clear_error() after situations
4c949f
where an error may have been set but it can just be ignored.
4c949f
4c949f
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
4c949f
Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>
4c949f
(cherry picked from commit 1c4deff7dc94da6157f64c398a58375a2c97e35b)
4c949f
---
4c949f
 osinfo/osinfo_tree.c | 7 +++++++
4c949f
 1 file changed, 7 insertions(+)
4c949f
4c949f
diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c
4c949f
index f256f8a..ef82807 100644
4c949f
--- a/osinfo/osinfo_tree.c
4c949f
+++ b/osinfo/osinfo_tree.c
4c949f
@@ -503,21 +503,25 @@ static OsinfoTree *load_keyinfo(const gchar *location,
4c949f
     if (!(family = g_key_file_get_string(file, "general", "family", error))) {
4c949f
         if (!is_unknown_group_or_key_error(*error))
4c949f
             goto cleanup;
4c949f
+        g_clear_error(error);
4c949f
     }
4c949f
 
4c949f
     if (!(variant = g_key_file_get_string(file, "general", "variant", error))) {
4c949f
         if (!is_unknown_group_or_key_error(*error))
4c949f
             goto cleanup;
4c949f
+        g_clear_error(error);
4c949f
     }
4c949f
 
4c949f
     if (!(version = g_key_file_get_string(file, "general", "version", error))) {
4c949f
         if (!is_unknown_group_or_key_error(*error))
4c949f
             goto cleanup;
4c949f
+        g_clear_error(error);
4c949f
     }
4c949f
 
4c949f
     if (!(arch = g_key_file_get_string(file, "general", "arch", error))) {
4c949f
         if (!is_unknown_group_or_key_error(*error))
4c949f
             goto cleanup;
4c949f
+        g_clear_error(error);
4c949f
     }
4c949f
 
4c949f
 
4c949f
@@ -527,16 +531,19 @@ static OsinfoTree *load_keyinfo(const gchar *location,
4c949f
         if (!(kernel = g_key_file_get_string(file, group, "kernel", error))) {
4c949f
             if (!is_unknown_group_or_key_error(*error))
4c949f
                 goto cleanup;
4c949f
+            g_clear_error(error);
4c949f
         }
4c949f
 
4c949f
         if (!(initrd = g_key_file_get_string(file, group, "initrd", error))) {
4c949f
             if (!is_unknown_group_or_key_error(*error))
4c949f
                 goto cleanup;
4c949f
+            g_clear_error(error);
4c949f
         }
4c949f
 
4c949f
         if (!(bootiso = g_key_file_get_string(file, group, "boot.iso", error))) {
4c949f
             if (!is_unknown_group_or_key_error(*error))
4c949f
                 goto cleanup;
4c949f
+            g_clear_error(error);
4c949f
         }
4c949f
     }
4c949f
 
4c949f
-- 
4c949f
2.21.0
4c949f