Skip to content

Commit a0a47a4

Browse files
ljd42danieldegrasse
authored andcommitted
Bluetooth: ASCS: fix uninitialized pointer read
Fix uninitialized pointer read reported by Coverity. Coverity CID: 529879 Signed-off-by: Loic Domaigne <tech@domaigne.com>
1 parent 36fe97f commit a0a47a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/bluetooth/audio/ascs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ static int ascs_ep_set_codec(struct bt_bap_ep *ep, uint8_t id, uint16_t cid, uin
15371537

15381538
static int ase_config(struct bt_ascs_ase *ase, const struct bt_ascs_config *cfg)
15391539
{
1540-
struct bt_bap_stream *stream;
1540+
struct bt_bap_stream *stream = NULL;
15411541
struct bt_audio_codec_cfg codec_cfg;
15421542
struct bt_bap_ascs_rsp rsp = BT_BAP_ASCS_RSP(BT_BAP_ASCS_RSP_CODE_SUCCESS,
15431543
BT_BAP_ASCS_REASON_NONE);
@@ -1603,6 +1603,7 @@ static int ase_config(struct bt_ascs_ase *ase, const struct bt_ascs_config *cfg)
16031603
err = -ENOTSUP;
16041604
rsp = BT_BAP_ASCS_RSP(BT_BAP_ASCS_RSP_CODE_UNSPECIFIED, BT_BAP_ASCS_REASON_NONE);
16051605
} else if (ase->ep.stream != NULL) {
1606+
stream = ase->ep.stream;
16061607
if (unicast_server_cb->reconfig != NULL) {
16071608
err = unicast_server_cb->reconfig(ase->ep.stream, ase->ep.dir,
16081609
&ase->ep.codec_cfg, &ase->ep.qos_pref,
@@ -1624,7 +1625,6 @@ static int ase_config(struct bt_ascs_ase *ase, const struct bt_ascs_config *cfg)
16241625
err = -EINVAL;
16251626
}
16261627

1627-
stream = ase->ep.stream;
16281628
ascs_app_rsp_warn_valid(&rsp);
16291629
}
16301630
} else {

0 commit comments

Comments
 (0)