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

Commit f4ce0676 authored by Rama Vaddula's avatar Rama Vaddula Committed by Manish Kumar
Browse files

Surface: Initialize variable and add a defensive check

Initialize buf variable and make sure to check for return
value of dequeueBuffer() before sending to the client.

Change-Id: I0569f2d45825fab0e5d0f38fc91a07990f57c7ab
(cherry picked from commit a6bd7106a7305208f187fbf0a48f14139e33c9d6)
(cherry picked from commit e5d7662d68c5be2b282edd58d4feb68a4d476182)
(cherry picked from commit 885c146144480d4371a0a97df89b8e77f53d3d94)
parent e242f0dc
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -117,9 +117,12 @@ int Surface::hook_queueBuffer(ANativeWindow* window,
int Surface::hook_dequeueBuffer_DEPRECATED(ANativeWindow* window,
        ANativeWindowBuffer** buffer) {
    Surface* c = getSelf(window);
    ANativeWindowBuffer* buf;
    ANativeWindowBuffer* buf = NULL;
    int fenceFd = -1;
    int result = c->dequeueBuffer(&buf, &fenceFd);

    if (result != NO_ERROR) return result;

    sp<Fence> fence(new Fence(fenceFd));
    int waitResult = fence->waitForever("dequeueBuffer_DEPRECATED");
    if (waitResult != OK) {