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

Commit 89f14dac authored by Yin-Chia Yeh's avatar Yin-Chia Yeh
Browse files

Camera2: Add null check to createStream

Prevent a native null dereference crash.

bug: 15332257
Change-Id: I10c4053a0b4f07fbf52c37dd2f2853b501def669
parent d8754e07
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -310,6 +310,10 @@ status_t CameraDeviceClient::createStream(int width, int height, int format,


    Mutex::Autolock icl(mBinderSerializationLock);
    Mutex::Autolock icl(mBinderSerializationLock);


    if (bufferProducer == NULL) {
        ALOGE("%s: bufferProducer must not be null", __FUNCTION__);
        return BAD_VALUE;
    }
    if (!mDevice.get()) return DEAD_OBJECT;
    if (!mDevice.get()) return DEAD_OBJECT;


    // Don't create multiple streams for the same target surface
    // Don't create multiple streams for the same target surface