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

Christophe Fergeau cfergeau at redhat.com
Mon Feb 11 08:56:47 UTC 2013


ACK series, thanks a lot for catching this osinfo-detect segfault!
Do you have commit access to the git repository?

Christophe

On Fri, Feb 08, 2013 at 01:37:51PM -0500, Cole Robinson wrote:
> 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
> 
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20130211/55529b9f/attachment.sig>


More information about the Libosinfo mailing list