* [PATCH] s390: char: con3215: Free memory in error path
@ 2015-04-19 13:17 Christophe Jaillet
2015-04-20 8:32 ` Martin Schwidefsky
0 siblings, 1 reply; 2+ messages in thread
From: Christophe Jaillet @ 2015-04-19 13:17 UTC (permalink / raw)
To: schwidefsky, heiko.carstens
Cc: linux390, linux-s390, linux-kernel, kernel-janitors,
Christophe Jaillet
If one memory allocation fails, there is a memory leak.
Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.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;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] s390: char: con3215: Free memory in error path
2015-04-19 13:17 [PATCH] s390: char: con3215: Free memory in error path Christophe Jaillet
@ 2015-04-20 8:32 ` Martin Schwidefsky
0 siblings, 0 replies; 2+ messages in thread
From: Martin Schwidefsky @ 2015-04-20 8:32 UTC (permalink / raw)
To: Christophe Jaillet
Cc: heiko.carstens, linux390, linux-s390, linux-kernel,
kernel-janitors
On Sun, 19 Apr 2015 15:17:36 +0200
Christophe Jaillet <christophe.jaillet@wanadoo.fr> wrote:
> If one memory allocation fails, there is a memory leak.
>
> Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-20 8:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-19 13:17 [PATCH] s390: char: con3215: Free memory in error path Christophe Jaillet
2015-04-20 8:32 ` Martin Schwidefsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox