commit | d723dd91916a7b32001518d219351747446560f2 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <treehugger-gerrit@google.com> | Tue Jan 19 18:27:14 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Jan 19 18:27:14 2021 +0000 |
tree | ebadff86cd5140b5e1c2576de34b4259228d2173 | |
parent | 56f018b1e42d48410c991d3aefdcc07c6f3564db [diff] | |
parent | 9c7e15ab310a979ead2402a87267884f19a279d6 [diff] |
Merge "Fixed Handler Leak on WrapperInit" am: 9c7e15ab31 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1495716 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I5070ec1f948d3fee3eacf5f6069417b8c7d7474a
diff --git a/core/java/com/android/internal/os/WrapperInit.java b/core/java/com/android/internal/os/WrapperInit.java index 790d7f7..6860759e 100644 --- a/core/java/com/android/internal/os/WrapperInit.java +++ b/core/java/com/android/internal/os/WrapperInit.java
@@ -69,15 +69,16 @@ // Tell the Zygote what our actual PID is (since it only knows about the // wrapper that it directly forked). if (fdNum != 0) { + FileDescriptor fd = new FileDescriptor(); try { - FileDescriptor fd = new FileDescriptor(); fd.setInt$(fdNum); DataOutputStream os = new DataOutputStream(new FileOutputStream(fd)); os.writeInt(Process.myPid()); os.close(); - IoUtils.closeQuietly(fd); } catch (IOException ex) { Slog.d(TAG, "Could not write pid of wrapped process to Zygote pipe.", ex); + } finally { + IoUtils.closeQuietly(fd); } }