thunderbolt: fix double free in bolt client

In the async version of the client creation, i.e. when a new client
is created via bolt_client_new_async and an error happens it will be
passed to g_task_return_error which takes ownership of it but the very
same error will also be free'd via g_autoptr; remove the latter.

This is a port of bolt commit e96f8bd47587b167ae46c8ac9347003f69f931dd
This commit is contained in:
Christian Kellner 2019-01-08 17:22:41 +01:00
parent 4496680e86
commit 06894e020a

View file

@ -219,7 +219,7 @@ got_the_client (GObject *source,
GAsyncResult *res,
gpointer user_data)
{
g_autoptr(GError) error = NULL;
GError *error = NULL;
GTask *task = user_data;
GObject *obj;
@ -227,6 +227,7 @@ got_the_client (GObject *source,
if (obj == NULL)
{
/* error ownership gets transferred to the task */
g_task_return_error (task, error);
return;
}
@ -240,7 +241,7 @@ got_the_bus (GObject *source,
GAsyncResult *res,
gpointer user_data)
{
g_autoptr(GError) error = NULL;
GError *error = NULL;
GTask *task = user_data;
GCancellable *cancellable;
GDBusConnection *bus;
@ -249,6 +250,7 @@ got_the_bus (GObject *source,
if (bus == NULL)
{
g_prefix_error (&error, "could not connect to D-Bus: ");
/* error ownership gets transferred to the task */
g_task_return_error (task, error);
return;
}