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

Commit d791c2d4 authored by Fabien Sanglard's avatar Fabien Sanglard Committed by Zhao Wei Liew
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 cc92c1b5
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -70,6 +70,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
@@ -79,14 +87,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);