[Libosinfo] [osinfo-db-tools PATCH v2 7/9] validate: Simplify validate_file_directory()

Fabiano Fidêncio fidencio at redhat.com
Wed Jul 3 10:14:08 UTC 2019


Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 tools/osinfo-db-validate.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c
index 7fd87d2..3a1717f 100644
--- a/tools/osinfo-db-validate.c
+++ b/tools/osinfo-db-validate.c
@@ -123,11 +123,12 @@ static gboolean validate_file_directory(xmlRelaxNGValidCtxtPtr rngValid, GFile *
 
     while ((info = g_file_enumerator_next_file(children, NULL, error))) {
         GFile *child = g_file_get_child(file, g_file_info_get_name(info));
-        if (!validate_file(rngValid, child, info, error)) {
-            g_object_unref(child);
+        gboolean ret_validate;
+        ret_validate = validate_file(rngValid, child, info, error);
+        g_clear_object(&child);
+
+        if (!ret_validate)
             goto cleanup;
-        }
-        g_object_unref(child);
     }
 
     if (*error)
-- 
2.21.0




More information about the Libosinfo mailing list