From 13d7ddac23d21c3301c923e613b738436e3a8d49 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Tue, 25 Jul 2017 14:22:07 -0700 Subject: [PATCH] Silence a memory leak warning from the static analyzer The analyzer assumes that the given `put` operation may fail. This shouldn't be the case, so mark it with a LOG_ALWAYS_FATAL_IF. Doing so silences a warning about potential memory leaks originating from TessellationCache::getRoundRect. Bug: 27101951 Test: mma. Warning is gone. Change-Id: I3adeacd6c2c9c03caecd989e2a1267c51e8ef905 --- libs/hwui/TessellationCache.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp index d9e811684610f..4ea440dd106fa 100644 --- a/libs/hwui/TessellationCache.cpp +++ b/libs/hwui/TessellationCache.cpp @@ -416,7 +416,9 @@ TessellationCache::Buffer* TessellationCache::getOrCreateBuffer( mProcessor = new TessellationProcessor(Caches::getInstance()); } mProcessor->add(task); - mCache.put(entry, buffer); + bool inserted = mCache.put(entry, buffer); + // Note to the static analyzer that this insert should always succeed. + LOG_ALWAYS_FATAL_IF(!inserted, "buffers shouldn't spontaneously appear in the cache"); } return buffer; }