[Libosinfo] [libosinfo PATCH v2 3/3] tree: cleanup on any error & return on _create_from_location_async_helper()

Fabiano Fidêncio fidencio at redhat.com
Wed Jul 17 12:24:50 UTC 2019


When calling a g_task_return_error(), we should also cleanup the
CreateFromLocationAsyncData and return immediately after that.

By doing so we avoid errors as:
g_task_return_error: assertion 'task->ever_returned' failed.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 osinfo/osinfo_tree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c
index b65d399..1524b94 100644
--- a/osinfo/osinfo_tree.c
+++ b/osinfo/osinfo_tree.c
@@ -758,6 +758,8 @@ osinfo_tree_create_from_location_async_helper(CreateFromLocationAsyncData *data,
                             _("URL protocol is not supported"));
 
         g_task_return_error(data->res, error);
+        create_from_location_async_data_free(data);
+        return;
     }
 
     location = g_strdup_printf("%s/%s", data->location, treeinfo);
-- 
2.21.0




More information about the Libosinfo mailing list