We should check whether the objects are NULL or not before calling g_object_unref(). Instead of doing so, let's use g_clear_object(), which doesn't require the check. Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> --- osinfo/osinfo_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c index 8e98f6c..03b6f3b 100644 --- a/osinfo/osinfo_tree.c +++ b/osinfo/osinfo_tree.c @@ -47,9 +47,9 @@ struct _CreateFromLocationAsyncData { static void create_from_location_async_data_free(CreateFromLocationAsyncData *data) { - g_object_unref(data->session); - g_object_unref(data->message); - g_object_unref(data->res); + g_clear_object(&data->session); + g_clear_object(&data->message); + g_clear_object(&data->res); g_slice_free(CreateFromLocationAsyncData, data); } -- 2.21.0 _______________________________________________ Libosinfo mailing list Libosinfo@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libosinfo