OSDN Git Service

media: platform: sti: c8sectpfe: core: Add of_node_put() at goto
authorNishka Dasgupta <nishkadg.linux@gmail.com>
Tue, 16 Jul 2019 05:38:31 +0000 (07:38 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 27 Nov 2020 06:53:26 +0000 (07:53 +0100)
commitbf9d46f751e75bf3d9a48bd69675f95d86ff7eb9
treefcd86383f18cb487694d87adb7e53b244cd8b279
parentd0ac1a26ed5943127cb0156148735f5f52a07075
media: platform: sti: c8sectpfe: core: Add of_node_put() at goto

Each iteration of for_each_child_of_node puts the previous node, but in
the case of a goto from the middle of the loop, there is no put, thus
causing a memory leak. Hence add a new label that puts the last used
node, and edit the goto statements in the middle of the loop to first go
to the new label.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c