media: vsp1: fix memory leak of dl on error return path
authorColin Ian King <colin.king@canonical.com>
Sun, 28 Jul 2019 17:11:24 +0000 (14:11 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 11:09:42 +0000 (13:09 +0200)
commit3dfbac0add221d43a330ce669df54d71050e12b2
treef2d534d3dda40e63094888f31a191cc1f47c72c7
parentc47022e019fe243c12412541f6957935a78b30f2
media: vsp1: fix memory leak of dl on error return path

[ Upstream commit 70c55c1ad1a76e804ee5330e134674f5d2741cb7 ]

Currently when the call vsp1_dl_body_get fails and returns null the
error return path leaks the allocation of dl. Fix this by kfree'ing
dl before returning.

Addresses-Coverity: ("Resource leak")

Fixes: 5d7936b8e27d ("media: vsp1: Convert display lists to use new body pool")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/vsp1/vsp1_dl.c