From 6a04e5fcf67e754b215301fe38a6401db567f4b5 Mon Sep 17 00:00:00 2001 From: Dan Stoza Date: Mon, 1 Jun 2015 13:59:15 -0700 Subject: [PATCH] libgui: Propagate error by clearing sp Clears the sp returned by createGraphicBuffer when there is an error during unflattening. Bug: 21498231 Change-Id: I886da4474fc06853cc59188d62044b7d7549126b --- libs/gui/IGraphicBufferAlloc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/gui/IGraphicBufferAlloc.cpp b/libs/gui/IGraphicBufferAlloc.cpp index 09b63a189..300998996 100644 --- a/libs/gui/IGraphicBufferAlloc.cpp +++ b/libs/gui/IGraphicBufferAlloc.cpp @@ -59,6 +59,9 @@ public: if (result == NO_ERROR) { graphicBuffer = new GraphicBuffer(); result = reply.read(*graphicBuffer); + if (result != NO_ERROR) { + graphicBuffer.clear(); + } // reply.readStrongBinder(); // here we don't even have to read the BufferReference from // the parcel, it'll die with the parcel.