diff options
author | Xiaoke Wang <xkernel.wang@foxmail.com> | 2021-12-13 15:39:31 +0800 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-12-13 10:38:27 +0100 |
commit | c01c1db1dc632edafb0dff32d40daf4f9c1a4e19 (patch) | |
tree | aa267940e2b263a6627e1afad6ae14211b8aaabb /sound | |
parent | 2dee54b289fbc810669a1b2b8a0887fa1c9a14d7 (diff) | |
download | linux-c01c1db1dc632edafb0dff32d40daf4f9c1a4e19.tar.bz2 |
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: Xiaoke Wang <xkernel.wang@foxmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/tencent_094816F3522E0DC704056C789352EBBF0606@qq.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/jack.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/core/jack.c b/sound/core/jack.c index 32350c6aba84..537df1e98f8a 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -509,6 +509,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, return -ENOMEM; jack->id = kstrdup(id, GFP_KERNEL); + if (jack->id == NULL) { + kfree(jack); + return -ENOMEM; + } /* don't creat input device for phantom jack */ if (!phantom_jack) { |