From 89264eaa586873e7e90345f8b1c9f3dc089cd8df Mon Sep 17 00:00:00 2001 From: Sebastien MICHEL Date: Fri, 1 Apr 2016 15:25:39 +0200 Subject: [PATCH] Add fclose to avoid leak on native heaps This leak involves the "dumpsys gfxinfo" command and can be observed on following processes: * systemui * system_server * googlequicksearchbox Change-Id: I5d0048a8a0c487ef5f88896fe294efebc9381e2a Tracked-On: https://jira01.devtools.intel.com/browse/OAM-17934 Signed-off-by: Sebastien MICHEL Reviewed-on: https://android.intel.com:443/489997 --- libs/hwui/renderthread/RenderProxy.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index e65cb11ec12f..100a27fdfee1 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -449,7 +449,7 @@ void RenderProxy::resetProfileInfo() { CREATE_BRIDGE2(dumpGraphicsMemory, int fd, RenderThread* thread) { args->thread->jankTracker().dump(args->fd); - FILE *file = fdopen(args->fd, "a"); + FILE *file = fdopen(dup(args->fd), "a"); if (Caches::hasInstance()) { String8 cachesLog; Caches::getInstance().dumpMemoryUsage(cachesLog); @@ -458,6 +458,7 @@ CREATE_BRIDGE2(dumpGraphicsMemory, int fd, RenderThread* thread) { fprintf(file, "\nNo caches instance.\n"); } fflush(file); + fclose(file); return nullptr; } -- 2.11.0