Whamcloud - gitweb
profile_create_node: set magic before strdup(name) to avoid memory leak
authorwuguanghao <wuguanghao3@huawei.com>
Wed, 30 Jun 2021 08:27:13 +0000 (16:27 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 16 Jul 2021 03:17:46 +0000 (23:17 -0400)
commitcac906a942f41b9b8515b10877d3e0b23ef548a9
tree9458eb4e6c0ea1b5e78b1b67cb4ff5ab82b13495
parent657715deb85ce5cdea7bc2cc11dde2058d73f4c9
profile_create_node: set magic before strdup(name) to avoid memory leak

If new->magic != PROF_MAGIC_NODE, profile_free_node() don't free node.
This will cause the node to be unable to be released correctly and
a memory leak will occur.

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Reviewed-by: Wu Bo <wubo40@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/support/profile.c