From f1ddecc60e0fe4c68961c06ffe0d0c9fdc463791 Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Thu, 23 Apr 2020 12:34:20 -0700 Subject: Close heap dump ParcelFileDescriptor. The file descriptor is only closed in certain situations. Explicitly closing it to ensure we don't have any leaks. Bug: 154277871 Test: take a system heap dump via developer options & and watch for StrictMode violation Test: adb shell am dumpheap & and watch for StrictMode violation Change-Id: I3ae3e270bcec18ba531055becfff32924c8f2a2d --- core/java/android/app/ActivityThread.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/java/android/app/ActivityThread.java') diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 7d6ce41763d7..3208da7d3e36 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -1170,6 +1170,8 @@ public final class ActivityThread extends ClientTransactionHandler { } catch (IOException e) { Slog.e(TAG, "Failed to duplicate heap dump file descriptor", e); return; + } finally { + IoUtils.closeQuietly(fd); } dhd.finishCallback = finishCallback; sendMessage(H.DUMP_HEAP, dhd, 0, 0, true /*async*/); -- cgit v1.2.3