[PATCH v2] dt-ops: fix memory leak when new_node malloc fails

Simon Horman horms at verge.net.au
Wed Dec 9 07:43:19 EST 2020


On Tue, Dec 01, 2020 at 12:06:16PM +0800, qiuguorui1 wrote:
> In function dtb_set_property, when malloc new_node fails,
> we need to free new_dtb before return.
> 
> Fixes: f56cbcf4c2766 ("kexec/dt-ops.c: Fix '/chosen' v/s 'chosen' node
> being passed to fdt helper functions")
> Signed-off-by: qiuguorui1 <qiuguorui1 at huawei.com>
> 
> v2:
>   use goto instead of free here,based on Simon Horman's advice:
>   "Can we use the goto idiom here, as is used elsewhere in this function?"
> 
> v1: http://lists.infradead.org/pipermail/kexec/2020-November/021809.html

Thanks, applied.



More information about the kexec mailing list