[Libosinfo] [libosinfo PATCH v2 2/3] tree: goto cleanup on any error, on on_content_read()

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


Instead of just free'ing the CreateFromLocationAsyncData, let's just go
to cleanup, which will call create_from_location_async_data_free() and
return 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, 1 insertion(+), 1 deletion(-)

diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c
index 03b6f3b..b65d399 100644
--- a/osinfo/osinfo_tree.c
+++ b/osinfo/osinfo_tree.c
@@ -676,7 +676,7 @@ static void on_content_read(GObject *source,
                                         &error)) {
         g_prefix_error(&error, _("Failed to load .treeinfo|treeinfo content: "));
         g_task_return_error(data->res, error);
-        create_from_location_async_data_free(data);
+        goto cleanup;
     }
 
     if (!(ret = load_keyinfo(data->location,
-- 
2.21.0




More information about the Libosinfo mailing list