[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e5c3dede-2c59-4c64-7a8c-f022ee06cbfa@ideasonboard.com>
Date: Mon, 29 Jul 2019 13:11:30 +0100
From: Kieran Bingham <kieran.bingham+renesas@...asonboard.com>
To: Colin King <colin.king@...onical.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: vsp1: fix memory leak of dl on error return path
Hi Colin,
On 28/07/2019 18:11, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> 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.
Eeep. This does indeed look to be the case.
>
> Addresses-Coverity: ("Resource leak")
> Fixes: 5d7936b8e27d ("media: vsp1: Convert display lists to use new body pool")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
Thank you!
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@...asonboard.com>
> ---
> drivers/media/platform/vsp1/vsp1_dl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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);
>
>
Powered by blists - more mailing lists