From 3cae13ee934311b438ea15e773bc5c7d965d1cd8 Mon Sep 17 00:00:00 2001 From: Gui Hecheng Date: Thu, 12 Dec 2013 18:41:07 +0800 Subject: 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 Signed-off-by: David Sterba Signed-off-by: Chris Mason --- btrfs-list.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'btrfs-list.c') 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); } -- cgit v1.2.3