From 0fabedf085591b50994e4f8c133bfa87f1777ee4 Mon Sep 17 00:00:00 2001 From: Maninder Singh Date: Mon, 1 Jun 2015 10:38:07 +0000 Subject: fix if(p)/free(p) construct No need of explicit NULL check before free. Signed-off-by: Maninder Singh Signed-off-by: Akhilesh Kumar Signed-off-by: Denys Vlasenko --- e2fsprogs/old_e2fsprogs/blkid/dev.c | 3 +-- e2fsprogs/old_e2fsprogs/fsck.c | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'e2fsprogs/old_e2fsprogs') diff --git a/e2fsprogs/old_e2fsprogs/blkid/dev.c b/e2fsprogs/old_e2fsprogs/blkid/dev.c index 84b7b0a72..c2bbb06f3 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/dev.c +++ b/e2fsprogs/old_e2fsprogs/blkid/dev.c @@ -44,8 +44,7 @@ void blkid_free_dev(blkid_dev dev) bit_tags); blkid_free_tag(tag); } - if (dev->bid_name) - free(dev->bid_name); + free(dev->bid_name); free(dev); } diff --git a/e2fsprogs/old_e2fsprogs/fsck.c b/e2fsprogs/old_e2fsprogs/fsck.c index 91cce970c..87874ce71 100644 --- a/e2fsprogs/old_e2fsprogs/fsck.c +++ b/e2fsprogs/old_e2fsprogs/fsck.c @@ -354,12 +354,9 @@ static void parse_escape(char *word) static void free_instance(struct fsck_instance *i) { - if (i->prog) - free(i->prog); - if (i->device) - free(i->device); - if (i->base_device) - free(i->base_device); + free(i->prog); + free(i->device); + free(i->base_device); free(i); } @@ -432,8 +429,7 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) fs = create_fs_device(device, mntpnt, type ? type : "auto", opts, freq ? atoi(freq) : -1, passno ? atoi(passno) : -1); - if (dev) - free(dev); + free(dev); if (!fs) return -1; -- cgit v1.2.3