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
diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.cpp b/services/surfaceflinger/SurfaceFlingerConsumer.cpp
index c71b3bc..edd53a3 100644
--- a/services/surfaceflinger/SurfaceFlingerConsumer.cpp
+++ b/services/surfaceflinger/SurfaceFlingerConsumer.cpp
@@ -69,6 +69,14 @@
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 @@
return BUFFER_REJECTED;
}
- if (autoRefresh) {
- *autoRefresh = item.mAutoRefresh;
- }
-
- if (queuedBuffer) {
- *queuedBuffer = item.mQueuedBuffer;
- }
-
// Release the previous buffer.
#ifdef USE_HWC2
err = updateAndReleaseLocked(item, &mPendingRelease);