diff options
author | George Burgess IV <gbiv@google.com> | 2017-07-18 15:59:47 -0700 |
---|---|---|
committer | George Burgess IV <gbiv@google.com> | 2017-07-18 17:00:06 -0700 |
commit | 09c00f25af6e711275dd8a562294ebd904c4eace (patch) | |
tree | eb86be535f864dc9b9b128e3a592370f82e29f7c /libs/hwui/renderstate | |
parent | 1ad8903bb6f8c7f4b77e71f73cb0ea2aa9db2576 (diff) |
Fix use-after-free
Since putOrDelete may delete the layer, we shouldn't be accessing its
member after calling it.
Caught by the static analyzer:
frameworks/base/libs/hwui/renderstate/OffscreenBufferPool.cpp:183:44:
warning: Use of memory after it is freed
Bug: 27101951
Test: mma. Static analyzer warning is gone.
Change-Id: I25ee8b45ede608da52bf58d1d9f52ce3bb60d4cb
Diffstat (limited to 'libs/hwui/renderstate')
-rw-r--r-- | libs/hwui/renderstate/OffscreenBufferPool.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/hwui/renderstate/OffscreenBufferPool.cpp b/libs/hwui/renderstate/OffscreenBufferPool.cpp index 90b27c8d8fb0..2dfa6d4dc839 100644 --- a/libs/hwui/renderstate/OffscreenBufferPool.cpp +++ b/libs/hwui/renderstate/OffscreenBufferPool.cpp @@ -179,8 +179,9 @@ OffscreenBuffer* OffscreenBufferPool::resize(OffscreenBuffer* layer, layer->region.clear(); return layer; } + bool wideColorGamut = layer->wideColorGamut; putOrDelete(layer); - return get(renderState, width, height, layer->wideColorGamut); + return get(renderState, width, height, wideColorGamut); } void OffscreenBufferPool::dump() { |