Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09c00f25 authored by George Burgess IV's avatar George Burgess IV
Browse files

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
parent 1ad8903b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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() {