Commit 70c55c1a authored by Colin Ian King's avatar Colin Ian King Committed by Mauro Carvalho Chehab

media: vsp1: fix memory leak of dl on error return path

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: 5d7936b8 ("media: vsp1: Convert display lists to use new body pool")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent b20a6e29
...@@ -557,8 +557,10 @@ static struct vsp1_dl_list *vsp1_dl_list_alloc(struct vsp1_dl_manager *dlm) ...@@ -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. */ /* Get a default body for our list. */
dl->body0 = vsp1_dl_body_get(dlm->pool); dl->body0 = vsp1_dl_body_get(dlm->pool);
if (!dl->body0) if (!dl->body0) {
kfree(dl);
return NULL; return NULL;
}
header_offset = dl->body0->max_entries * sizeof(*dl->body0->entries); header_offset = dl->body0->max_entries * sizeof(*dl->body0->entries);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment