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

Commit 7bcb9597 authored by Zach Johnson's avatar Zach Johnson Committed by Sharvil Nanavati
Browse files

Fix BluetoothSocket file descriptor leak

Sockets accepted on a server socket didn't populate
the mPfd field, which is used to close out the java
end of the native-and-java communication socket when
the overall rfcomm socket is closed. #badnewsbears

b/21398841

Change-Id: I3adb0a9965f83d0f3006fa4f79ea4abeab5c9a17
parent c3d69a79
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -191,6 +191,8 @@ public final class BluetoothSocket implements Closeable {
            as.close();
            throw new IOException("bt socket acept failed");
        }

        as.mPfd = new ParcelFileDescriptor(fds[0]);
        as.mSocket = new LocalSocket(fds[0]);
        as.mSocketIS = as.mSocket.getInputStream();
        as.mSocketOS = as.mSocket.getOutputStream();