public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [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

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