From b159633aa3b91301de108a0b32e4634c72f34d14 Mon Sep 17 00:00:00 2001 From: Mykola Kondratenko Date: Thu, 12 Mar 2015 15:20:38 +0100 Subject: [PATCH] hwui : fix memory leak due to duplicate in shadow cache New ShadowTask with the ShadowDescription key that already exists in the shadow LruCache will leak as it is not being added. Fix adds check for the existing key that is common in the hwui code but missing for the TessellationCache::precacheShadow function. Change-Id: I37fd5ec82f8b8da5d1ec0f2ab9fd04c5f8534367 --- libs/hwui/TessellationCache.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp index bc956be8a0596..1d6b7cc94fc79 100644 --- a/libs/hwui/TessellationCache.cpp +++ b/libs/hwui/TessellationCache.cpp @@ -380,6 +380,7 @@ void TessellationCache::precacheShadows(const Matrix4* drawTransform, const Rect const Vector3& lightCenter, float lightRadius) { ShadowDescription key(casterPerimeter, drawTransform); + if (mShadowCache.get(key)) return; sp task = new ShadowTask(drawTransform, localClip, opaque, casterPerimeter, transformXY, transformZ, lightCenter, lightRadius); if (mShadowProcessor == NULL) {