Skip to content

Commit 452b897

Browse files
Thalleyjhedberg
authored andcommitted
samples: Bluetooth: Add missing bt_conn_ref for a few samples
Some samples were missing a call to bt_conn_ref when assigning default_conn. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 8924d5c commit 452b897

File tree

3 files changed

+3
-3
lines changed
  • samples/bluetooth

3 files changed

+3
-3
lines changed

samples/bluetooth/iso_connected_benchmark/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ static void connected(struct bt_conn *conn, uint8_t err)
426426
default_conn = NULL;
427427
return;
428428
} else if (role == ROLE_PERIPHERAL) {
429-
default_conn = conn;
429+
default_conn = bt_conn_ref(conn);
430430
}
431431

432432
LOG_INF("Connected: %s", addr);

samples/bluetooth/peripheral_past/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static void connected(struct bt_conn *conn, uint8_t err)
7979
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
8080

8181
if (default_conn == NULL) {
82-
default_conn = conn;
82+
default_conn = bt_conn_ref(conn);
8383
}
8484

8585
if (conn != default_conn) {

samples/bluetooth/unicast_audio_server/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static void connected(struct bt_conn *conn, uint8_t err)
222222
}
223223

224224
printk("Connected: %s\n", addr);
225-
default_conn = conn;
225+
default_conn = bt_conn_ref(conn);
226226
}
227227

228228
static void disconnected(struct bt_conn *conn, uint8_t reason)

0 commit comments

Comments
 (0)