Merge "Surface: cancel the dequeued buffer when requestBuffer fails" into lmp-dev
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index b56030e..0e2baa2 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -237,6 +237,7 @@
         result = mGraphicBufferProducer->requestBuffer(buf, &gbuf);
         if (result != NO_ERROR) {
             ALOGE("dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: %d", result);
+            mGraphicBufferProducer->cancelBuffer(buf, fence);
             return result;
         }
     }