Skip to content

Commit

Permalink
ALSA: usb-audio: fix rate_list memory leak
Browse files Browse the repository at this point in the history
The array of sample rates is reallocated every time when opening
the PCM device, but was freed only once when unplugging the device.

Reported-by: "Alexander E. Patrakov" <[email protected]>
Cc: <[email protected]>
Signed-off-by: Clemens Ladisch <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
cladisch authored and tiwai committed May 31, 2012
1 parent adcc70b commit 5cd5d7c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/usb/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,9 @@ static int snd_usb_pcm_check_knot(struct snd_pcm_runtime *runtime,
int count = 0, needs_knot = 0;
int err;

kfree(subs->rate_list.list);
subs->rate_list.list = NULL;

list_for_each_entry(fp, &subs->fmt_list, list) {
if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS)
return 0;
Expand Down

0 comments on commit 5cd5d7c

Please sign in to comment.