[PATCH] install-script tool: Take GFile creation out of the loop

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

 



From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx>

Also, unref the GFile when done.
---
 tools/osinfo-install-script.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c
index 0f5656b..9eabea6 100644
--- a/tools/osinfo-install-script.c
+++ b/tools/osinfo-install-script.c
@@ -190,6 +190,7 @@ static gboolean generate_script(OsinfoOs *os)
     OsinfoInstallScriptList *scripts = osinfo_os_get_install_script_list(os);
     OsinfoInstallScriptList *profile_scripts;
     OsinfoFilter *filter;
+    GFile *dir;
     GList *l, *tmp;
     gboolean ret = FALSE;
     GError *error = NULL;
@@ -209,10 +210,10 @@ static gboolean generate_script(OsinfoOs *os)
         goto cleanup;
     }
 
+    dir = g_file_new_for_commandline_arg(output_dir ? output_dir : ".");
+
     for (tmp = l; tmp != NULL; tmp = tmp->next) {
         OsinfoInstallScript *script = tmp->data;
-        GFile *dir = g_file_new_for_commandline_arg(output_dir ?
-                                                    output_dir : ".");
 
         if (prefix)
             osinfo_install_script_set_output_prefix(script, prefix);
@@ -237,6 +238,7 @@ static gboolean generate_script(OsinfoOs *os)
     g_object_unref(scripts);
     g_object_unref(filter);
     g_object_unref(profile_scripts);
+    g_object_unref(dir);
     return ret;
 }
 
-- 
1.8.1

_______________________________________________
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