[gnome-control-center] thunderbolt: fix double free in bolt client
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] thunderbolt: fix double free in bolt client
- Date: Tue, 8 Jan 2019 16:35:14 +0000 (UTC)
commit 06894e020a75b9ea670ed524a02b6bf939dc4e9c
Author: Christian Kellner <christian kellner me>
Date: Tue Jan 8 17:22:41 2019 +0100
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
panels/thunderbolt/bolt-client.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/panels/thunderbolt/bolt-client.c b/panels/thunderbolt/bolt-client.c
index 0ebc360b1..00038bd7b 100644
--- a/panels/thunderbolt/bolt-client.c
+++ b/panels/thunderbolt/bolt-client.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]