[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <325e5c0cbcc756b88dfc78b6d9388c07be7aa8f1.1446996521.git.geliangtang@163.com>
Date: Sun, 8 Nov 2015 23:32:18 +0800
From: Geliang Tang <geliangtang@....com>
To: Minchan Kim <minchan@...nel.org>, Nitin Gupta <ngupta@...are.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc: Geliang Tang <geliangtang@....com>, linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] zram: fix memory freeing in zram_meta_alloc
When meta->table is NULL, there is no need to vfree it.
Signed-off-by: Geliang Tang <geliangtang@....com>
---
drivers/block/zram/zram_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 81a557c..197a7ad 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -511,7 +511,7 @@ static struct zram_meta *zram_meta_alloc(char *pool_name, u64 disksize)
meta->table = vzalloc(num_pages * sizeof(*meta->table));
if (!meta->table) {
pr_err("Error allocating zram address table\n");
- goto out_error;
+ goto out_free;
}
meta->mem_pool = zs_create_pool(pool_name, GFP_NOIO | __GFP_HIGHMEM);
@@ -524,6 +524,7 @@ static struct zram_meta *zram_meta_alloc(char *pool_name, u64 disksize)
out_error:
vfree(meta->table);
+out_free:
kfree(meta);
return NULL;
}
--
2.5.0
--
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