summaryrefslogtreecommitdiff
path: root/btrfs-list.c
diff options
context:
space:
mode:
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>2013-12-12 18:41:07 +0800
committerChris Mason <clm@fb.com>2014-01-31 08:22:17 -0800
commit3cae13ee934311b438ea15e773bc5c7d965d1cd8 (patch)
tree35ac1175f20ba9a6b317e2f40d93ee639d389942 /btrfs-list.c
parente3c9596d3fc8b0df647a6cbae55c2d77570de759 (diff)
btrfs-progs: remove NULL-ptr judge before free for btrfs-progs
free(3) already checks the pointer for NULL, no need to do it on your own. This patch make the change globally. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'btrfs-list.c')
-rw-r--r--btrfs-list.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/btrfs-list.c b/btrfs-list.c
index 6a38dd54..fa69910b 100644
--- a/btrfs-list.c
+++ b/btrfs-list.c
@@ -399,8 +399,7 @@ static int update_root(struct root_lookup *root_lookup,
if (!ri || ri->root_id != root_id)
return -ENOENT;
if (name && name_len > 0) {
- if (ri->name)
- free(ri->name);
+ free(ri->name);
ri->name = malloc(name_len + 1);
if (!ri->name) {
@@ -515,15 +514,9 @@ static void __free_root_info(struct rb_node *node)
struct root_info *ri;
ri = rb_entry(node, struct root_info, rb_node);
- if (ri->name)
- free(ri->name);
-
- if (ri->path)
- free(ri->path);
-
- if (ri->full_path)
- free(ri->full_path);
-
+ free(ri->name);
+ free(ri->path);
+ free(ri->full_path);
free(ri);
}