From 4832438c3a31a5316f8b33ccfbe961accd946e2e Mon Sep 17 00:00:00 2001 From: liulvping Date: Thu, 20 Dec 2018 20:34:56 +0800 Subject: fix mmap leak of graphicsstats service Test: repeat dumpsys graphicsstats and check process maps Change-Id: Iae2baa7eb7761aefb867644edfaaf8dbe2132c7b Signed-off-by: liulvping --- libs/hwui/service/GraphicsStatsService.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/hwui/service/GraphicsStatsService.cpp b/libs/hwui/service/GraphicsStatsService.cpp index 3d50d2d7e59c..29e4256e2ab7 100644 --- a/libs/hwui/service/GraphicsStatsService.cpp +++ b/libs/hwui/service/GraphicsStatsService.cpp @@ -139,6 +139,7 @@ bool GraphicsStatsService::parseFromFile(const std::string& path, uint32_t file_version = *reinterpret_cast(addr); if (file_version != sCurrentFileVersion) { ALOGW("file_version mismatch! expected %d got %d", sCurrentFileVersion, file_version); + munmap(addr, sb.st_size); return false; } @@ -150,6 +151,7 @@ bool GraphicsStatsService::parseFromFile(const std::string& path, ALOGW("Parse failed on '%s' error='%s'", path.c_str(), output->InitializationErrorString().c_str()); } + munmap(addr, sb.st_size); return success; } -- cgit v1.2.3-59-g8ed1b