[Libosinfo] [PATCH 1/3] install-script tool: Fix compiler warning

Cole Robinson crobinso at redhat.com
Fri Feb 8 18:37:51 UTC 2013


osinfo-install-script.c: In function 'main':
osinfo-install-script.c:245:19: error: 'dir' may be used uninitialized in this function [-Werror=maybe-uninitialized]
osinfo-install-script.c:196:12: note: 'dir' was declared here

And add me to AUTHORS to appease syntax-check
---
 AUTHORS                       | 1 +
 tools/osinfo-install-script.c | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 626c17b..79bc980 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -22,6 +22,7 @@ Patches contributed by:
   Eric Blake <eblake at redhat.com>
   Yuri Chornoivan <yurchor at ukr.net>
   Marc-André Lureau <marcandre.lureau at redhat.com>
+  Cole Robinson <crobinso at redhat.com>
   ...send patches to get your name here...
 
 -- End
diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c
index 73f1d3d..866a545 100644
--- a/tools/osinfo-install-script.c
+++ b/tools/osinfo-install-script.c
@@ -193,7 +193,7 @@ static gboolean generate_script(OsinfoOs *os)
     OsinfoInstallScriptList *scripts = osinfo_os_get_install_script_list(os);
     OsinfoInstallScriptList *profile_scripts;
     OsinfoFilter *filter;
-    GFile *dir;
+    GFile *dir = NULL;
     GList *l, *tmp;
     gboolean ret = FALSE;
     GError *error = NULL;
@@ -242,7 +242,8 @@ static gboolean generate_script(OsinfoOs *os)
     g_object_unref(scripts);
     g_object_unref(filter);
     g_object_unref(profile_scripts);
-    g_object_unref(dir);
+    if (dir)
+        g_object_unref(dir);
     return ret;
 }
 
-- 
1.8.1




More information about the Libosinfo mailing list