Skip to content

Commit

Permalink
media: vsp1: fix memory leak of dl on error return path
Browse files Browse the repository at this point in the history
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: 5d7936b ("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>
  • Loading branch information
Colin Ian King authored and mchehab committed Aug 14, 2019
1 parent b20a6e2 commit 70c55c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/media/platform/vsp1/vsp1_dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 70c55c1

Please sign in to comment.