]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group
authorNanyong Sun <sunnanyong@huawei.com>
Tue, 24 Aug 2021 00:00:01 +0000 (10:00 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Aug 2021 23:34:56 +0000 (09:34 +1000)
commit2ef34726ec35b0b25aa4dc5804399cafbf7eba3a
tree5407da83da1175e391e6ac57464d85017a74fb07
parent7a93b66e4b71634d250ef23dea7008c0428aeba6
nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group

If kobject_init_and_add return with error, kobject_put() is needed here to
avoid memory leak, because kobject_init_and_add may return error without
freeing the memory associated with the kobject it allocated.

Link: https://lkml.kernel.org/r/20210629022556.3985106-4-sunnanyong@huawei.com
Link: https://lkml.kernel.org/r/1625651306-10829-4-git-send-email-konishi.ryusuke@gmail.com
Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
fs/nilfs2/sysfs.c