Skip to content

Commit 6b94fb1

Browse files
takaswietiwai
authored andcommitted
ALSA: dice: fix memory leak when unplugging
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: 4bdc495('ALSA: dice: handle several PCM substreams when any isochronous streams are available') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 83a9efb commit 6b94fb1

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

sound/firewire/dice/dice-stream.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -446,18 +446,12 @@ int snd_dice_stream_init_duplex(struct snd_dice *dice)
446446

447447
void snd_dice_stream_destroy_duplex(struct snd_dice *dice)
448448
{
449-
struct reg_params tx_params, rx_params;
450-
451-
snd_dice_transaction_clear_enable(dice);
449+
unsigned int i;
452450

453-
if (get_register_params(dice, &tx_params, &rx_params) == 0) {
454-
stop_streams(dice, AMDTP_IN_STREAM, &tx_params);
455-
stop_streams(dice, AMDTP_OUT_STREAM, &rx_params);
451+
for (i = 0; i < MAX_STREAMS; i++) {
452+
destroy_stream(dice, AMDTP_IN_STREAM, i);
453+
destroy_stream(dice, AMDTP_OUT_STREAM, i);
456454
}
457-
458-
release_resources(dice);
459-
460-
dice->substreams_counter = 0;
461455
}
462456

463457
void snd_dice_stream_update_duplex(struct snd_dice *dice)

0 commit comments

Comments
 (0)