Use vector instead of raw pointer in l2cap socket write handling
Currently, when we receive data from upper layers for LE CoC socket, we store it in memory and pass a raw pointer around, keeping memory until the write is acknowledged by controller and event is sent back to btif layer in on_l2cap_write*_done. If anything goes wrong, we might loose the pointer to the data and have a memory leak. From now on, we store the data in std::vector and pass its ownership down the stack. The moment the data is copied into lower layer buffer, vector is automatically freed. We no longer pass the data back to on_l2cap_write*_done callback. Bug: 68359837 Test: compilation test Change-Id: If34c0fba8d4a040a242b8c655491b8967a03b96a
Loading
Please register or sign in to comment