From 0d3d74618e8fc25cc0522aaecb10afef5ea7e4af Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 24 Feb 2015 16:15:55 +0200 Subject: [PATCH] shared/gatt-client: Fix memory leak The following leak happens whenever bt_gatt_client_write_long_value is called: 40 bytes in 1 blocks are definitely lost in loss record 36 of 97 at 0x4C2B946: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x437D0F: request_create (gatt-client.c:127) by 0x439C74: bt_gatt_client_write_without_response (gatt-client.c:2132) by 0x42DF61: test_signed_write (test-gatt.c:843) by 0x42EDFC: client_ready_cb (test-gatt.c:568) by 0x4391EE: notify_client_ready (gatt-client.c:977) by 0x43A761: init_complete (gatt-client.c:1278) by 0x437590: discover_descs_cb (gatt-client.c:702) by 0x434005: discovery_op_complete (gatt-helpers.c:605) by 0x434099: discover_descs_cb (gatt-helpers.c:1421) by 0x433543: handle_rsp (att.c:640) by 0x433543: can_read_data (att.c:805) by 0x44045A: watch_callback (io-glib.c:170) --- src/shared/gatt-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index a966dd08f..cc972d661 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -2139,7 +2139,7 @@ unsigned int bt_gatt_client_write_without_response( req->att_id = bt_att_send(client->att, signed_write ? BT_ATT_OP_SIGNED_WRITE_CMD : BT_ATT_OP_WRITE_CMD, pdu, sizeof(pdu), - NULL, NULL, NULL); + NULL, req, request_unref); if (!req->att_id) { request_unref(req); return 0; -- 2.47.3