From: Shen Feng <shen@cn.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] Btrfs: do not call kfree if kmalloc failed in btrfs_sysfs_add_super
Date: Mon, 29 Dec 2008 11:44:23 +0800 [thread overview]
Message-ID: <49584797.6010402@cn.fujitsu.com> (raw)
kfree should not be called if kmalloc is not success.
Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
---
fs/btrfs/sysfs.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 300076e..04087c0 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -212,14 +212,13 @@ int btrfs_sysfs_add_super(struct btrfs_fs_info *fs)
fs->super_kobj.kset = btrfs_kset;
error = kobject_init_and_add(&fs->super_kobj, &btrfs_super_ktype,
NULL, "%s", name);
+ kfree(name);
if (error)
goto fail;
- kfree(name);
return 0;
fail:
- kfree(name);
printk(KERN_ERR "btrfs: sysfs creation for super failed\n");
return error;
}
--
1.6.0.6
reply other threads:[~2008-12-29 3:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49584797.6010402@cn.fujitsu.com \
--to=shen@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox