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