Skip to content

Commit

Permalink
s390/3215: free memory in error path
Browse files Browse the repository at this point in the history
If one memory allocation fails, there is a memory leak.

Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Christophe Jaillet authored and Martin Schwidefsky committed Apr 23, 2015
1 parent 0b46e0a commit 0a7c501
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/s390/char/con3215.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0a7c501

Please sign in to comment.