commit | 1b2d59500a8c066dec413f906c480ee46f004df5 | [log] [tgz] |
---|---|---|
author | Nick Kralevich <nnk@google.com> | Tue Jun 18 17:56:28 2013 -0700 |
committer | Nick Kralevich <nnk@google.com> | Tue Jun 18 17:56:28 2013 -0700 |
tree | 02e9113acd62ed256f00432e32d440b9f83dd475 | |
parent | 9f6bb77eb61a465f13147ada9a920d7ba9567c92 [diff] |
NativeCrashListener: fix file descriptor leak. Sending thousands of crashes can result in the system eventually running out of file descriptors. Close file descriptors after we're done with them. Change-Id: I09ae9ce36426ded3fd591dda9a3550a19c2f01d3
diff --git a/services/java/com/android/server/am/NativeCrashListener.java b/services/java/com/android/server/am/NativeCrashListener.java index 307ab03..2c7f1f1 100644 --- a/services/java/com/android/server/am/NativeCrashListener.java +++ b/services/java/com/android/server/am/NativeCrashListener.java
@@ -152,6 +152,13 @@ Slog.d(TAG, "Exception writing ack: " + e.getMessage()); } } + try { + Libcore.os.close(peerFd); + } catch (ErrnoException e) { + if (MORE_DEBUG) { + Slog.d(TAG, "Exception closing socket: " + e.getMessage()); + } + } } } }