android/gatt: Fix possible NULL pointer defererence

If memory allocation failed, return error from handle_client_register.
This commit is contained in:
Marcin Kraglak 2014-03-27 22:13:01 +01:00 committed by Szymon Janc
parent 1f949a0982
commit 8d2cc1ff3d

View File

@ -234,6 +234,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));