Skip to content

Commit

Permalink
ALSA: dice: fix memory leak when unplugging
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
takaswie authored and tiwai committed Mar 28, 2016
1 parent 83a9efb commit 6b94fb1
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions sound/firewire/dice/dice-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,18 +446,12 @@ int snd_dice_stream_init_duplex(struct snd_dice *dice)

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)
Expand Down

0 comments on commit 6b94fb1

Please sign in to comment.