From 774255fdd4e7eb2a30404b4475019c049161149d Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 6 Feb 2018 07:00:14 -0200 Subject: [PATCH] gatt: Fix memory leak If bt_gatt_client_register_notify fails the client shall be freed. Change-Id: Ie478a2df0edb4129129daa1fb3448c44cfcc7efa Signed-off-by: Amit Purwar --- src/gatt-client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gatt-client.c b/src/gatt-client.c index d667f2c..9eceee4 100644 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -1679,8 +1679,10 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn, register_notify_io_cb, notify_io_cb, client, NULL); - if (!client->notify_id) + if (!client->notify_id) { + notify_client_unref(client); return btd_error_failed(msg, "Failed to subscribe"); + } queue_push_tail(chrc->notify_clients, client); -- 2.7.4