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

Commit 0a4b26ec authored by Fabien Sanglard's avatar Fabien Sanglard
Browse files

Fix surfaceflinger file descriptor leak

If a producer queues a buffer after a screen resize, the buffer
will not be removed from the buffer queue, resulting in a leak of
file descriptor.

Test: Fix was tested by the bug reporter (ARM).
Bug: 32012717

Change-Id: I3b7b0745d5fbdee97fc8df2db399c1a2fcdeb375
parent 8a767feb
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -69,6 +69,14 @@ status_t SurfaceFlingerConsumer::updateTexImage(BufferRejecter* rejecter,
        return err;
    }

    if (autoRefresh) {
        *autoRefresh = item.mAutoRefresh;
    }

    if (queuedBuffer) {
        *queuedBuffer = item.mQueuedBuffer;
    }

    // We call the rejecter here, in case the caller has a reason to
    // not accept this buffer.  This is used by SurfaceFlinger to
    // reject buffers which have the wrong size
@@ -78,14 +86,6 @@ status_t SurfaceFlingerConsumer::updateTexImage(BufferRejecter* rejecter,
        return BUFFER_REJECTED;
    }

    if (autoRefresh) {
        *autoRefresh = item.mAutoRefresh;
    }

    if (queuedBuffer) {
        *queuedBuffer = item.mQueuedBuffer;
    }

    // Release the previous buffer.
#ifdef USE_HWC2
    err = updateAndReleaseLocked(item, &mPendingRelease);