[PATCHv2 03/11] android/gatt: Service error when client cannot be created

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If memory allocation failed, return error from handle_client_register.
---
 android/gatt.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/android/gatt.c b/android/gatt.c
index 1af7e33..2e93ef7 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -239,6 +239,11 @@ static void handle_client_register(const void *buf, uint16_t len)
 	}
 
 	client = new0(struct gatt_client, 1);
+	if (!client) {
+		error("gatt: cannot allocate memory for registering client");
+		status = HAL_STATUS_FAILED;
+		goto failed;
+	}
 
 	memcpy(client->uuid, cmd->uuid, sizeof(client->uuid));
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux