camera: fix two potential null pointer uses

Caught by the static analyzer:
hardware/interfaces/camera/device/1.0/default/CameraDevice.cpp:401:9:
warning: Called C++ object pointer is null
[clang-analyzer-core.CallAndMessage]

Bug: None
Test: TreeHugger
Change-Id: Ia6d0a2ab4b4d04cfc171629c7dbf60ead181625d
This commit is contained in:
George Burgess IV
2019-11-01 13:31:25 -07:00
parent 51d32a6881
commit 2ea148804a

View File

@@ -397,9 +397,11 @@ void CameraDevice::sPutMemory(camera_memory_t *data) {
CameraDevice* device = mem->handle.mDevice;
if (device == nullptr) {
ALOGE("%s: camera HAL return memory for a null device!", __FUNCTION__);
return;
}
if (device->mDeviceCallback == nullptr) {
ALOGE("%s: camera HAL return memory while camera is not opened!", __FUNCTION__);
return;
}
device->mDeviceCallback->unregisterMemory(mem->handle.mId);
{