ALSA: hda: fix potential memleak in 'add_widget_node'
authorYe Bin <yebin10@huawei.com>
Thu, 10 Nov 2022 14:45:39 +0000 (22:45 +0800)
committerTakashi Iwai <tiwai@suse.de>
Thu, 10 Nov 2022 14:28:12 +0000 (15:28 +0100)
commit9a5523f72bd2b0d66eef3d58810c6eb7b5ffc143
tree95e0f4d07b7317848f25af774767b70a6aed2915
parent9736a325137b62499d2b4be3fc2d742b131f75da
ALSA: hda: fix potential memleak in 'add_widget_node'

As 'kobject_add' may allocated memory for 'kobject->name' when return error.
And in this function, if call 'kobject_add' failed didn't free kobject.
So call 'kobject_put' to recycling resources.

Signed-off-by: Ye Bin <yebin10@huawei.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20221110144539.2989354-1-yebin@huaweicloud.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/hda/hdac_sysfs.c