summaryrefslogtreecommitdiff
path: root/e2fsprogs/blkid
diff options
context:
space:
mode:
authorRob Landley2006-03-01 16:39:45 +0000
committerRob Landley2006-03-01 16:39:45 +0000
commite7c43b66d74ee9902a6732122788a7a16bcfbf18 (patch)
treeebb8583e9e1265588592614c0b4878daded44125 /e2fsprogs/blkid
parent93f2286e6e59dab5eed14b5912a79254031c5a62 (diff)
downloadbusybox-e7c43b66d74ee9902a6732122788a7a16bcfbf18.zip
busybox-e7c43b66d74ee9902a6732122788a7a16bcfbf18.tar.gz
Cleanup patch from Denis Vlasenko. Mostly variants of removing the if(x)
from before "if(x) free(x)".
Diffstat (limited to 'e2fsprogs/blkid')
-rw-r--r--e2fsprogs/blkid/cache.c3
-rw-r--r--e2fsprogs/blkid/devno.c3
-rw-r--r--e2fsprogs/blkid/resolve.c6
-rw-r--r--e2fsprogs/blkid/save.c3
-rw-r--r--e2fsprogs/blkid/tag.c18
5 files changed, 11 insertions, 22 deletions
diff --git a/e2fsprogs/blkid/cache.c b/e2fsprogs/blkid/cache.c
index 87be126..daccb30 100644
--- a/e2fsprogs/blkid/cache.c
+++ b/e2fsprogs/blkid/cache.c
@@ -88,8 +88,7 @@ void blkid_put_cache(blkid_cache cache)
}
blkid_free_tag(tag);
}
- if (cache->bic_filename)
- free(cache->bic_filename);
+ free(cache->bic_filename);
free(cache);
}
diff --git a/e2fsprogs/blkid/devno.c b/e2fsprogs/blkid/devno.c
index 7d083e7..2979280 100644
--- a/e2fsprogs/blkid/devno.c
+++ b/e2fsprogs/blkid/devno.c
@@ -218,8 +218,7 @@ int main(int argc, char** argv)
}
printf("Looking for device 0x%04Lx\n", devno);
devname = blkid_devno_to_devname(devno);
- if (devname)
- free(devname);
+ free(devname);
return 0;
}
#endif
diff --git a/e2fsprogs/blkid/resolve.c b/e2fsprogs/blkid/resolve.c
index 591b630..40d999a 100644
--- a/e2fsprogs/blkid/resolve.c
+++ b/e2fsprogs/blkid/resolve.c
@@ -96,10 +96,8 @@ char *blkid_get_devname(blkid_cache cache, const char *token,
ret = blkid_strdup(blkid_dev_devname(dev));
errout:
- if (t)
- free(t);
- if (v)
- free(v);
+ free(t);
+ free(v);
if (!cache) {
blkid_put_cache(c);
}
diff --git a/e2fsprogs/blkid/save.c b/e2fsprogs/blkid/save.c
index cc406eb..98d8d02 100644
--- a/e2fsprogs/blkid/save.c
+++ b/e2fsprogs/blkid/save.c
@@ -148,8 +148,7 @@ int blkid_flush_cache(blkid_cache cache)
}
errout:
- if (tmp)
- free(tmp);
+ free(tmp);
return ret;
}
diff --git a/e2fsprogs/blkid/tag.c b/e2fsprogs/blkid/tag.c
index e2c785c..95112eb 100644
--- a/e2fsprogs/blkid/tag.c
+++ b/e2fsprogs/blkid/tag.c
@@ -41,11 +41,8 @@ void blkid_free_tag(blkid_tag tag)
list_del(&tag->bit_tags); /* list of tags for this device */
list_del(&tag->bit_names); /* list of tags with this type */
- if (tag->bit_name)
- free(tag->bit_name);
- if (tag->bit_val)
- free(tag->bit_val);
-
+ free(tag->bit_name);
+ free(tag->bit_val);
free(tag);
}
@@ -112,8 +109,7 @@ int blkid_set_tag(blkid_dev dev, const char *name,
return -BLKID_ERR_MEM;
t = blkid_find_tag_dev(dev, name);
if (!value) {
- if (t)
- blkid_free_tag(t);
+ blkid_free_tag(t);
} else if (t) {
if (!strcmp(t->bit_val, val)) {
/* Same thing, exit */
@@ -165,12 +161,10 @@ int blkid_set_tag(blkid_dev dev, const char *name,
return 0;
errout:
- if (t)
- blkid_free_tag(t);
- else if (val)
+ blkid_free_tag(t);
+ if (!t)
free(val);
- if (head)
- blkid_free_tag(head);
+ blkid_free_tag(head);
return -BLKID_ERR_MEM;
}