From 617efb6bb8cd3afbfd36411925469537be218229 Mon Sep 17 00:00:00 2001 From: Anand Jain Date: Fri, 26 Apr 2013 10:44:45 +0800 Subject: [PATCH] btrfs-progs: mkfs seg fault for wrong free With commit 87c09f7 Btrfs-progs: fix memory leaks on cleanup mkfs on multiple dev is ending with segfault at close_all_devices() during kfree(device->name) because mkfs calls btrfs_add_to_fsid, which does not initialize name when dev is added to the list. Signed-off-by: Anand Jain Signed-off-by: Chris Mason --- utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.c b/utils.c index 412de80c..7b4cd74f 100644 --- a/utils.c +++ b/utils.c @@ -482,7 +482,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, u64 num_devs; int ret; - device = kmalloc(sizeof(*device), GFP_NOFS); + device = kzalloc(sizeof(*device), GFP_NOFS); if (!device) return -ENOMEM; buf = kmalloc(sectorsize, GFP_NOFS);