OSDN Git Service

ALSA: hda - Fix a memory leak bug
authorWenwen Wang <wenwen@cs.uga.edu>
Sat, 10 Aug 2019 04:29:48 +0000 (23:29 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Aug 2019 08:51:43 +0000 (10:51 +0200)
commit3248c0892da13ffd05275c86edd2a3287b931962
tree0c3f2105001a49c1240fb6f6366dbbe6ede30511
parentc6a46c615274da0cfb4090140ceea0427ae13e22
ALSA: hda - Fix a memory leak bug

commit cfef67f016e4c00a2f423256fc678a6967a9fc09 upstream.

In snd_hda_parse_generic_codec(), 'spec' is allocated through kzalloc().
Then, the pin widgets in 'codec' are parsed. However, if the parsing
process fails, 'spec' is not deallocated, leading to a memory leak.

To fix the above issue, free 'spec' before returning the error.

Fixes: 352f7f914ebb ("ALSA: hda - Merge Realtek parser code to generic parser")
Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/pci/hda/hda_generic.c