Diff between db7c5f23af05999304edd7da72c1a5b043f17e9e and 3f30b47d13c0a4a9b7a61fa563fb672c5de0eb81

Changed Files

File Additions Deletions Status
android/gatt.c +6 -1 modified

Full Patch

diff --git a/android/gatt.c b/android/gatt.c
index 930afb3..624f62b 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -4356,6 +4356,7 @@ static void send_dev_complete_response(struct gatt_device *device,
 		if (val->error) {
 			queue_destroy(temp, NULL);
 			error = val->error;
+			destroy_pending_request(val);
 			goto done;
 		}
 
@@ -4369,6 +4370,9 @@ static void send_dev_complete_response(struct gatt_device *device,
 		adl = att_data_list_alloc(queue_length(temp), sizeof(uint16_t) +
 									length);
 
+		if (val)
+			destroy_pending_request(val);
+
 		val = queue_pop_head(temp);
 		while (val) {
 			uint8_t *value = adl->data[iterator++];
@@ -5643,7 +5647,8 @@ static uint8_t read_by_type(const uint8_t *cmd, uint16_t cmd_len,
 
 		data->state = REQUEST_INIT;
 		data->handle = handle;
-		queue_push_tail(device->pending_requests, data);
+		if (!queue_push_tail(device->pending_requests, data))
+			free(data);
 	}
 
 	queue_destroy(q, NULL);