浏览代码

s390/3215: free memory in error path

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>
Christophe Jaillet 10 年之前
父节点
当前提交
0a7c501e67
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/s390/char/con3215.c

+ 2 - 0
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;
 	}