]> git.baikalelectronics.ru Git - kernel.git/commit
parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries
authorMiaoqian Lin <linmq006@gmail.com>
Thu, 20 Jan 2022 12:18:12 +0000 (12:18 +0000)
committerHelge Deller <deller@gmx.de>
Fri, 21 Jan 2022 21:48:54 +0000 (22:48 +0100)
commite3758b992f68ef4cf5a2332b28d0288f22fb9b53
tree28a9b63bb9fcc2149ab373d19380fb57464baf08
parentdf082e5d5846fb65cd58a5ec35ee0750a22aaec1
parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries

kobject_init_and_add() takes reference even when it fails.
According to the doc of kobject_init_and_add():

   If this function returns an error, kobject_put() must be called to
   properly clean up the memory associated with the object.

Fix memory leak by calling kobject_put().

Fixes: d6ba8f9d0a66 ("Kobject: change drivers/parisc/pdc_stable.c to use kobject_init_and_add")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/parisc/pdc_stable.c