[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150420103207.7491723c@mschwide>
Date: Mon, 20 Apr 2015 10:32:07 +0200
From: Martin Schwidefsky <schwidefsky@...ibm.com>
To: Christophe Jaillet <christophe.jaillet@...adoo.fr>
Cc: heiko.carstens@...ibm.com, linux390@...ibm.com,
linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] s390: char: con3215: Free memory in error path
On Sun, 19 Apr 2015 15:17:36 +0200
Christophe Jaillet <christophe.jaillet@...adoo.fr> wrote:
> If one memory allocation fails, there is a memory leak.
>
> Signed-off-by: Christophe Jaillet <christophe.jaillet@...adoo.fr>
> ---
> drivers/s390/char/con3215.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
> index c43aca6..0fc3fe5 100644
> --- a/drivers/s390/char/con3215.c
> +++ b/drivers/s390/char/con3215.c
> @@ -667,6 +667,8 @@ static struct raw3215_info *raw3215_alloc_info(void)
> info->buffer = kzalloc(RAW3215_BUFFER_SIZE, GFP_KERNEL | GFP_DMA);
> info->inbuf = kzalloc(RAW3215_INBUF_SIZE, GFP_KERNEL | GFP_DMA);
> if (!info->buffer || !info->inbuf) {
> + kfree(info->inbuf);
> + kfree(info->buffer);
> kfree(info);
> return NULL;
> }
Applied, thanks.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists