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

Commit 3002d9dd authored by Matthew Xie's avatar Matthew Xie Committed by Andre Eisenbach
Browse files

Clean up fd when failed to add monitor thread

Bug: 10773872
Change-Id: I7f5b5f976ee7fa522e02b9ee4369b8f152b15cfb
parent 8ea5347c
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -343,8 +343,13 @@ bt_status_t btsock_rfc_listen(const char* service_name, const uint8_t* service_u
        BTA_JvCreateRecordByUser((void *)(intptr_t)rs->id);
        *sock_fd = rs->app_fd;
        rs->app_fd = -1; //the fd ownership is transferred to app
        if (btsock_thread_add_fd(pth, rs->fd, BTSOCK_RFCOMM, SOCK_THREAD_FD_EXCEPTION, rs->id)) {
            status = BT_STATUS_SUCCESS;
        btsock_thread_add_fd(pth, rs->fd, BTSOCK_RFCOMM, SOCK_THREAD_FD_EXCEPTION, rs->id);
        }
        else
        {
            cleanup_rfc_slot(rs);
        }
    }
    unlock_slot(&slot_lock);
    return status;