Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ea14880 authored by George Burgess IV's avatar George Burgess IV
Browse files

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
parent 51d32a68
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);
    {