From: Clemens Ladisch Date: Fri, 18 May 2012 16:00:43 +0000 (+0200) Subject: ALSA: usb-audio: fix rate_list memory leak X-Git-Tag: v3.0.34~25 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a6923156ec0556f79a8ec5deb40d1aa929184b21;p=karo-tx-linux.git ALSA: usb-audio: fix rate_list memory leak commit 5cd5d7c44990658df6ab49f6253c39617c53b03d upstream. 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" Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index b8dcbf407bbb..506c0fa679f6 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -670,6 +670,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;