mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-30 15:53:22 -05:00
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: Xiaoke Wang <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
44c743f63d
commit
fdaf41977d
1 changed files with 4 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue