diff options
author | Matthew Xie <mattx@google.com> | 2014-09-03 10:04:00 -0700 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2014-09-03 19:25:39 +0000 |
commit | 726652e9d3f1adf6b68dedfa4618b490b7f1b4a3 (patch) | |
tree | c400c10ccc89062e4ac8394721af38e4155e366c /core/java/android/bluetooth/BluetoothSocket.java | |
parent | a42c0de977fcd06e6c7a5be5b072fd661101ac58 (diff) | |
download | frameworks_base-726652e9d3f1adf6b68dedfa4618b490b7f1b4a3.zip frameworks_base-726652e9d3f1adf6b68dedfa4618b490b7f1b4a3.tar.gz frameworks_base-726652e9d3f1adf6b68dedfa4618b490b7f1b4a3.tar.bz2 |
Close the base socket when bindListen fails
Bug: 10773872
Change-Id: I0a72b2eb65055fa1959070d2dc32d40a573bd6f2
Diffstat (limited to 'core/java/android/bluetooth/BluetoothSocket.java')
-rw-r--r-- | core/java/android/bluetooth/BluetoothSocket.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothSocket.java b/core/java/android/bluetooth/BluetoothSocket.java index b98e5ae..36997e5 100644 --- a/core/java/android/bluetooth/BluetoothSocket.java +++ b/core/java/android/bluetooth/BluetoothSocket.java @@ -375,6 +375,14 @@ public final class BluetoothSocket implements Closeable { } // else ASSERT(mPort == channel) ret = 0; } catch (IOException e) { + if (mPfd != null) { + try { + mPfd.close(); + } catch (IOException e1) { + Log.e(TAG, "bindListen, close mPfd: " + e1); + } + mPfd = null; + } Log.e(TAG, "bindListen, fail to get port number, exception: " + e); return -1; } |