[alsa-devel] [PATCH] ALSA: hda - check NULL pointer when creating SPDIF controls

Takashi Iwai tiwai at suse.de
Thu Mar 7 09:13:13 CET 2013


At Thu,  7 Mar 2013 14:10:25 -0500,
mengdong.lin at intel.com wrote:
> 
> 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>

Thanks, applied.


Takashi

> 
> 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