Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b2d5950 authored by Nick Kralevich's avatar Nick Kralevich
Browse files

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
parent 9f6bb77e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -152,6 +152,13 @@ final class NativeCrashListener extends Thread {
                                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());
                            }
                        }
                    }
                }
            }