summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-07-28 14:11:24 -0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-05 13:13:40 +0200
commit3993c8429927a435efdd6a1d065c37241308c641 (patch)
treeaef143640bf66ad1a2d14953b02489fe0daab375 /drivers/media
parent91faaa0e282f0231896847bf28cb2df2f96c80fb (diff)
downloadlinux-stable-3993c8429927a435efdd6a1d065c37241308c641.tar.gz
linux-stable-3993c8429927a435efdd6a1d065c37241308c641.tar.bz2
linux-stable-3993c8429927a435efdd6a1d065c37241308c641.zip
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>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/vsp1/vsp1_dl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_dl.c b/drivers/media/platform/vsp1/vsp1_dl.c
index 104b6f514536..d7b43037e500 100644
--- a/drivers/media/platform/vsp1/vsp1_dl.c
+++ b/drivers/media/platform/vsp1/vsp1_dl.c
@@ -557,8 +557,10 @@ static struct vsp1_dl_list *vsp1_dl_list_alloc(struct vsp1_dl_manager *dlm)
/* Get a default body for our list. */
dl->body0 = vsp1_dl_body_get(dlm->pool);
- if (!dl->body0)
+ if (!dl->body0) {
+ kfree(dl);
return NULL;
+ }
header_offset = dl->body0->max_entries * sizeof(*dl->body0->entries);