Commit a08d7b29 authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Yongqiang Liu
Browse files

of: unittest: Add of_node_put() before return

mainline inclusion
from mainline-v5.4-rc1
commit a7bcae59
category: bugfix
bugzilla: 22762, https://gitee.com/openeuler/kernel/issues/I6H9U5
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a7bcae591f595a727feea9a5a389756015579072



--------------------------------

The local variable np in function of_unittest_platform_populate takes
the return value of of_find_node_by_path, which gets a node but does not
put it. If np is not put before return it may cause a memory leak. Hence
put np before a return statement.
Issue found with Coccinelle.

Signed-off-by: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarGuo Mengqi <guomengqi3@huawei.com>
Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 7675ff81
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment