提交 dd3fd8bd 编写于 作者: S Shen Feng 提交者: Chris Mason

Btrfs: do not call kfree if kmalloc failed in btrfs_sysfs_add_super

Signed-off-by: NShen Feng <shen@cn.fujitsu.com>
上级 1f483660
...@@ -212,14 +212,13 @@ int btrfs_sysfs_add_super(struct btrfs_fs_info *fs) ...@@ -212,14 +212,13 @@ int btrfs_sysfs_add_super(struct btrfs_fs_info *fs)
fs->super_kobj.kset = btrfs_kset; fs->super_kobj.kset = btrfs_kset;
error = kobject_init_and_add(&fs->super_kobj, &btrfs_super_ktype, error = kobject_init_and_add(&fs->super_kobj, &btrfs_super_ktype,
NULL, "%s", name); NULL, "%s", name);
kfree(name);
if (error) if (error)
goto fail; goto fail;
kfree(name);
return 0; return 0;
fail: fail:
kfree(name);
printk(KERN_ERR "btrfs: sysfs creation for super failed\n"); printk(KERN_ERR "btrfs: sysfs creation for super failed\n");
return error; return error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册