free surface buffers before trying to allocate new ones, so we have more chance of success
diff --git a/libs/surfaceflinger/LayerBitmap.cpp b/libs/surfaceflinger/LayerBitmap.cpp
index ff49c87..5221fed 100644
--- a/libs/surfaceflinger/LayerBitmap.cpp
+++ b/libs/surfaceflinger/LayerBitmap.cpp
@@ -178,6 +178,7 @@
{
Mutex::Autolock _l(mLock);
surface_info_t* info = mInfo;
+ mBuffer.clear(); // free buffer before allocating a new one
sp<Buffer> buffer = new Buffer(mWidth, mHeight, mFormat, mFlags);
status_t err = buffer->initCheck();
if (LIKELY(err == NO_ERROR)) {