Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/2] android/gatt: Fix possible memory leak in write request
@ 2014-05-26 14:06 Marcin Kraglak
  2014-05-26 14:06 ` [PATCH 2/2] android/gatt: Check permissions before write execution Marcin Kraglak
  2014-05-26 22:14 ` [PATCH 1/2] android/gatt: Fix possible memory leak in write request Szymon Janc
  0 siblings, 2 replies; 3+ messages in thread
From: Marcin Kraglak @ 2014-05-26 14:06 UTC (permalink / raw)
  To: linux-bluetooth

If write cannot be executed, remove data from queue and free
allocated memory.
---
 android/gatt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/android/gatt.c b/android/gatt.c
index e41a69e..721785a 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -4969,8 +4969,11 @@ static uint8_t write_req_request(const uint8_t *cmd, uint16_t cmd_len,
 	}
 
 	if (!gatt_db_write(gatt_db, handle, 0, value, vlen, cmd[0],
-								&dev->bdaddr))
+								&dev->bdaddr)) {
+		queue_remove(dev->pending_requests, data);
+		free(data);
 		return ATT_ECODE_UNLIKELY;
+	}
 
 	return 0;
 }
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-26 22:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-26 14:06 [PATCH 1/2] android/gatt: Fix possible memory leak in write request Marcin Kraglak
2014-05-26 14:06 ` [PATCH 2/2] android/gatt: Check permissions before write execution Marcin Kraglak
2014-05-26 22:14 ` [PATCH 1/2] android/gatt: Fix possible memory leak in write request Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox