* [PATCH] ALSA: dice: fix memory leak when unplugging
@ 2016-03-27 23:23 Takashi Sakamoto
2016-03-27 23:25 ` Takashi Sakamoto
0 siblings, 1 reply; 2+ messages in thread
From: Takashi Sakamoto @ 2016-03-27 23:23 UTC (permalink / raw)
To: clemens, tiwai; +Cc: alsa-devel, ffado-devel
When sound card is going to be released, dice private data is
also released. Then all of data should be released. However,
stream data is not released. This causes memory leak when
unplugging dice unit.
This commit fixes the bug.
Fixes: 4bdc495c87b3('ALSA: dice: handle several PCM substreams when any isochronous streams are available')
---
sound/firewire/dice/dice-stream.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c
index 845d5e5..ec4db3a 100644
--- a/sound/firewire/dice/dice-stream.c
+++ b/sound/firewire/dice/dice-stream.c
@@ -446,18 +446,12 @@ end:
void snd_dice_stream_destroy_duplex(struct snd_dice *dice)
{
- struct reg_params tx_params, rx_params;
-
- snd_dice_transaction_clear_enable(dice);
+ unsigned int i;
- if (get_register_params(dice, &tx_params, &rx_params) == 0) {
- stop_streams(dice, AMDTP_IN_STREAM, &tx_params);
- stop_streams(dice, AMDTP_OUT_STREAM, &rx_params);
+ for (i = 0; i < MAX_STREAMS; i++) {
+ destroy_stream(dice, AMDTP_IN_STREAM, i);
+ destroy_stream(dice, AMDTP_OUT_STREAM, i);
}
-
- release_resources(dice);
-
- dice->substreams_counter = 0;
}
void snd_dice_stream_update_duplex(struct snd_dice *dice)
--
2.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: dice: fix memory leak when unplugging
2016-03-27 23:23 [PATCH] ALSA: dice: fix memory leak when unplugging Takashi Sakamoto
@ 2016-03-27 23:25 ` Takashi Sakamoto
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Sakamoto @ 2016-03-27 23:25 UTC (permalink / raw)
To: clemens, tiwai; +Cc: alsa-devel, ffado-devel
On Mar 28 2016 08:23, Takashi Sakamoto wrote:
> When sound card is going to be released, dice private data is
> also released. Then all of data should be released. However,
> stream data is not released. This causes memory leak when
> unplugging dice unit.
>
> This commit fixes the bug.
>
> Fixes: 4bdc495c87b3('ALSA: dice: handle several PCM substreams when any isochronous streams are available')
Oops. I forgot to add 'Signed-off-by'. Please drop this...
> ---
> sound/firewire/dice/dice-stream.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c
> index 845d5e5..ec4db3a 100644
> --- a/sound/firewire/dice/dice-stream.c
> +++ b/sound/firewire/dice/dice-stream.c
> @@ -446,18 +446,12 @@ end:
>
> void snd_dice_stream_destroy_duplex(struct snd_dice *dice)
> {
> - struct reg_params tx_params, rx_params;
> -
> - snd_dice_transaction_clear_enable(dice);
> + unsigned int i;
>
> - if (get_register_params(dice, &tx_params, &rx_params) == 0) {
> - stop_streams(dice, AMDTP_IN_STREAM, &tx_params);
> - stop_streams(dice, AMDTP_OUT_STREAM, &rx_params);
> + for (i = 0; i < MAX_STREAMS; i++) {
> + destroy_stream(dice, AMDTP_IN_STREAM, i);
> + destroy_stream(dice, AMDTP_OUT_STREAM, i);
> }
> -
> - release_resources(dice);
> -
> - dice->substreams_counter = 0;
> }
>
> void snd_dice_stream_update_duplex(struct snd_dice *dice)
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-27 23:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-27 23:23 [PATCH] ALSA: dice: fix memory leak when unplugging Takashi Sakamoto
2016-03-27 23:25 ` Takashi Sakamoto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.