[alsa-devel] [PATCH] ALSA: hda - check NULL pointer when creating SPDIF controls
mengdong.lin at intel.com
mengdong.lin at intel.com
Thu Mar 7 20:10:25 CET 2013
From: Mengdong Lin <mengdong.lin at intel.com>
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 at intel.com>
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 04b5738..3dc6566 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -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)
--
1.7.10.4
More information about the Alsa-devel
mailing list