]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ALSA: hda - Fix a memory leak bug
authorWenwen Wang <wenwen@cs.uga.edu>
Sat, 10 Aug 2019 04:29:48 +0000 (23:29 -0500)
committerTakashi Iwai <tiwai@suse.de>
Sat, 10 Aug 2019 07:57:22 +0000 (09:57 +0200)
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>
sound/pci/hda/hda_generic.c

index 485edaba0037e5d6a477d2eb0e8b62f75fe06858..8f2beb1f3ae48ad8c56560a1ba44c9705e7083fc 100644 (file)
@@ -6100,7 +6100,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)