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

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

 



Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 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

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux