libaudiohal: Fix dereference before NULL check

deviceAddressFromHal was checking the wrong pointer before dereferencing.

Test: compile
Bug: 77263416
Change-Id: Ic47af7085dd88f451ae81034b84444719f68cfc5
Signed-off-by: Kevin Rocard <krocard@google.com>
gugelfrei
Kevin Rocard 6 years ago
parent 0c2e723765
commit 5915fa32fb

@ -53,7 +53,7 @@ status_t deviceAddressFromHal(
audio_devices_t device, const char* halAddress, DeviceAddress* address) {
address->device = AudioDevice(device);
if (address == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) {
if (halAddress == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) {
return OK;
}
const bool isInput = (device & AUDIO_DEVICE_BIT_IN) != 0;

@ -59,7 +59,7 @@ status_t deviceAddressFromHal(
audio_devices_t device, const char* halAddress, DeviceAddress* address) {
address->device = AudioDevice(device);
if (address == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) {
if (halAddress == nullptr || strnlen(halAddress, AUDIO_DEVICE_MAX_ADDRESS_LEN) == 0) {
return OK;
}
const bool isInput = (device & AUDIO_DEVICE_BIT_IN) != 0;

Loading…
Cancel
Save