]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
ALSA: hda - check NULL pointer when creating SPDIF controls
authorMengdong Lin <mengdong.lin@intel.com>
Thu, 7 Mar 2013 19:10:25 +0000 (14:10 -0500)
committerTakashi Iwai <tiwai@suse.de>
Thu, 7 Mar 2013 08:12:14 +0000 (09:12 +0100)
If the SPDIF control array cannot be reallocated, the function
will return to avoid dereferencing a NULL pointer.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c

index 04b57383e8cbcb89212e2d63960242653e774b21..3dc656688c08d3637b6b8e802c0b2334e306b811 100644 (file)
@@ -3334,6 +3334,8 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
                return -EBUSY;
        }
        spdif = snd_array_new(&codec->spdif_out);
+       if (!spdif)
+               return -ENOMEM;
        for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
                kctl = snd_ctl_new1(dig_mix, codec);
                if (!kctl)