Commit c01c1db1 authored by Xiaoke Wang's avatar Xiaoke Wang Committed by Takashi Iwai

ALSA: jack: Check the return value of kstrdup()

kstrdup() can return NULL, it is better to check the return value of it.
Signed-off-by: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/tencent_094816F3522E0DC704056C789352EBBF0606@qq.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2dee54b2
...@@ -509,6 +509,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, ...@@ -509,6 +509,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
return -ENOMEM; return -ENOMEM;
jack->id = kstrdup(id, GFP_KERNEL); jack->id = kstrdup(id, GFP_KERNEL);
if (jack->id == NULL) {
kfree(jack);
return -ENOMEM;
}
/* don't creat input device for phantom jack */ /* don't creat input device for phantom jack */
if (!phantom_jack) { if (!phantom_jack) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment