Skip to content

Commit d159037

Browse files
Austin Kimtiwai
authored andcommitted
ALSA: synth: missing check for possible NULL after the call to kstrdup
If kcalloc() return NULL due to memory starvation, it is possible for kstrdup() to return NULL in similar case. So add null check after the call to kstrdup() is made. [ minor coding-style fix by tiwai ] Signed-off-by: Austin Kim <austin.kim@lge.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20211109003742.GA5423@raspberrypi Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent ad4f93c commit d159037

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sound/synth/emux/emux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, ch
8888
emu->name = kstrdup(name, GFP_KERNEL);
8989
emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice),
9090
GFP_KERNEL);
91-
if (emu->voices == NULL)
91+
if (emu->name == NULL || emu->voices == NULL)
9292
return -ENOMEM;
9393

9494
/* create soundfont list */

0 commit comments

Comments
 (0)