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:
parent
4496680e86
commit
06894e020a
1 changed files with 4 additions and 2 deletions
|
@ -219,7 +219,7 @@ got_the_client (GObject *source,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_autoptr(GError) error = NULL;
|
GError *error = NULL;
|
||||||
GTask *task = user_data;
|
GTask *task = user_data;
|
||||||
GObject *obj;
|
GObject *obj;
|
||||||
|
|
||||||
|
@ -227,6 +227,7 @@ got_the_client (GObject *source,
|
||||||
|
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
{
|
{
|
||||||
|
/* error ownership gets transferred to the task */
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +241,7 @@ got_the_bus (GObject *source,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_autoptr(GError) error = NULL;
|
GError *error = NULL;
|
||||||
GTask *task = user_data;
|
GTask *task = user_data;
|
||||||
GCancellable *cancellable;
|
GCancellable *cancellable;
|
||||||
GDBusConnection *bus;
|
GDBusConnection *bus;
|
||||||
|
@ -249,6 +250,7 @@ got_the_bus (GObject *source,
|
||||||
if (bus == NULL)
|
if (bus == NULL)
|
||||||
{
|
{
|
||||||
g_prefix_error (&error, "could not connect to D-Bus: ");
|
g_prefix_error (&error, "could not connect to D-Bus: ");
|
||||||
|
/* error ownership gets transferred to the task */
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue