Re: [PATCH osinfo-db-tools 4/7] export: Don't call g_object_unref(NULL) in _create_file()

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

 



Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

On Fri, Sep 21, 2018 at 11:13:45AM +0200, Fabiano Fidêncio wrote:
> In osinfo_db_create_file() g_file_query_info() may fail which will leave
> @info as a NULL and we'll try to free it in the cleanup causing:
> (osinfo-db-export:32261): GLib-GObject-CRITICAL **: 11:00:08.488: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
> 
> In order to avoid that, let's only call g_object_unref() when @info is
> not NULL.
> 
> Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
> ---
>  tools/osinfo-db-export.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/osinfo-db-export.c b/tools/osinfo-db-export.c
> index 2c1bb8d..820196f 100644
> --- a/tools/osinfo-db-export.c
> +++ b/tools/osinfo-db-export.c
> @@ -286,7 +286,8 @@ static int osinfo_db_export_create_file(const gchar *prefix,
>      g_free(abspath);
>      g_free(relpath);
>      g_free(entpath);
> -    g_object_unref(info);
> +    if (info)
> +        g_object_unref(info);
>      if (err)
>          g_error_free(err);
>      return ret;
> -- 
> 2.17.1
> 
> _______________________________________________
> Libosinfo mailing list
> Libosinfo@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libosinfo

Attachment: signature.asc
Description: PGP signature

_______________________________________________
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