From 69e07f5a7b3934fac5bcf4c554e14e0d0b3cec47 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 29 Aug 2007 22:19:18 +0000 Subject: Fix memory issue. --- audio/a2dp.c | 5 +++-- audio/pcm_bluetooth.c | 8 ++++---- audio/unix.c | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/audio/a2dp.c b/audio/a2dp.c index 43b32ada..61510313 100644 --- a/audio/a2dp.c +++ b/audio/a2dp.c @@ -252,13 +252,13 @@ static gboolean a2dp_select_capabilities(struct avdtp_remote_sep *rsep, GSList **caps) { struct avdtp_service_capability *media_transport, *media_codec; - struct sbc_codec_cap sbc_cap, *acp_sbc; + struct sbc_codec_cap sbc_cap; if (!setup) return FALSE; if (setup->media_codec) - memcpy(&sbc_cap, setup->media_codec->data, sizeof(*acp_sbc)); + memcpy(&sbc_cap, setup->media_codec->data, sizeof(sbc_cap)); else { media_codec = avdtp_get_codec(rsep); if (!media_codec) @@ -278,6 +278,7 @@ static gboolean a2dp_select_capabilities(struct avdtp_remote_sep *rsep, *caps = g_slist_append(*caps, media_codec); + return TRUE; } diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c index 8ba18464..92a94fc0 100644 --- a/audio/pcm_bluetooth.c +++ b/audio/pcm_bluetooth.c @@ -948,7 +948,7 @@ static int bluetooth_cfg_init(struct ipc_packet *pkt, snd_config_t *conf) return -EINVAL; } - cfg->rate = strtod(rate, NULL); + cfg->rate = atoi(rate); continue; } @@ -991,7 +991,7 @@ static int bluetooth_cfg_init(struct ipc_packet *pkt, snd_config_t *conf) return -EINVAL; } - sbc->subbands = strtod(subbands, NULL); + sbc->subbands = atoi(subbands); continue; } @@ -1001,7 +1001,7 @@ static int bluetooth_cfg_init(struct ipc_packet *pkt, snd_config_t *conf) return -EINVAL; } - sbc->blocks = strtod(blocks, NULL); + sbc->blocks = atoi(blocks); continue; } @@ -1011,7 +1011,7 @@ static int bluetooth_cfg_init(struct ipc_packet *pkt, snd_config_t *conf) return -EINVAL; } - sbc->bitpool = strtod(bitpool, NULL); + sbc->bitpool = atoi(bitpool); continue; } diff --git a/audio/unix.c b/audio/unix.c index 6239c203..7fa2db05 100644 --- a/audio/unix.c +++ b/audio/unix.c @@ -449,6 +449,8 @@ static int cfg_to_caps(struct ipc_data_cfg *cfg, struct sbc_codec_cap *sbc_cap) { struct ipc_codec_sbc *sbc = (void *) cfg->data; + memset(sbc_cap, 0, sizeof(struct sbc_codec_cap)); + sbc_cap->cap.media_type = AVDTP_MEDIA_TYPE_AUDIO; sbc_cap->cap.media_codec_type = A2DP_CODEC_SBC; -- cgit