summaryrefslogtreecommitdiff
path: root/sound/pci
diff options
context:
space:
mode:
authorWenwen Wang <wenwen@cs.uga.edu>2019-08-09 23:29:48 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-08-25 10:51:43 +0200
commit3248c0892da13ffd05275c86edd2a3287b931962 (patch)
tree0c3f2105001a49c1240fb6f6366dbbe6ede30511 /sound/pci
parentc6a46c615274da0cfb4090140ceea0427ae13e22 (diff)
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>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_generic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index b0bd29003b5d..74223c0a6816 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -5898,7 +5898,7 @@ static int snd_hda_parse_generic_codec(struct hda_codec *codec)
err = snd_hda_parse_pin_defcfg(codec, &spec->autocfg, NULL, 0);
if (err < 0)
- return err;
+ goto error;
err = snd_hda_gen_parse_auto_config(codec, &spec->autocfg);
if (err < 0)