OSDN Git Service

L2CAP: Ensure handle is not null before attempting to close a socket
authorJoseph Pirozzo <pirozzoj@google.com>
Mon, 10 Oct 2016 14:05:51 +0000 (07:05 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Mon, 10 Oct 2016 18:41:20 +0000 (11:41 -0700)
Bug: 32054308
Test: manual, UPF 55
Change-Id: Ib89f7557fa390d60691afe8399a768e8127e52cb
(cherry picked from commit a1fa1bb0d638d5f444bf959fb839e824d69de31d)

btif/src/btif_sock_l2cap.cc

index 2d880e3..1beec45 100644 (file)
@@ -276,7 +276,7 @@ static void btsock_l2cap_free_l(l2cap_socket *sock)
     else
     {
         // Only call if we are non server connections
-        if (sock->handle && (sock->server == false)) {
+        if ((sock->handle >= 0) && (sock->server == false)) {
             if (sock->fixed_chan)
                 BTA_JvL2capCloseLE(sock->handle);
             else