Commit 5cd5d7c44990658df6ab49f6253c39617c53b03d

Authored by Clemens Ladisch
Committed by Takashi Iwai
1 parent adcc70b249

ALSA: usb-audio: fix rate_list memory leak

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" <patrakov@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff

... ... @@ -788,6 +788,9 @@
788 788 int count = 0, needs_knot = 0;
789 789 int err;
790 790  
  791 + kfree(subs->rate_list.list);
  792 + subs->rate_list.list = NULL;
  793 +
791 794 list_for_each_entry(fp, &subs->fmt_list, list) {
792 795 if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS)
793 796 return 0;