Bluetooth: Fix buffer leak in bt_conn_send

Since bt_conn_send doesn't currently return an error code it must be
assumed to consume the buffer no matter what. The only failure
condition is the "not connected" case, so make sure the buffer is
unreffed there.

Change-Id: I30e9a81d6f801a67d90ab59c1040b6f55261e71c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-11-05 21:11:19 +02:00 committed by Anas Nashif
commit f6bfb4377e

View file

@ -332,6 +332,7 @@ void bt_conn_send(struct bt_conn *conn, struct net_buf *buf)
if (conn->state != BT_CONN_CONNECTED) {
BT_ERR("not connected!\n");
net_buf_unref(buf);
return;
}