Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdaf4197 authored by Xiaoke Wang's avatar Xiaoke Wang Committed by Greg Kroah-Hartman
Browse files

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



commit c01c1db1dc632edafb0dff32d40daf4f9c1a4e19 upstream.

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


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 44c743f6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -220,6 +220,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) {