diff options
author | Brian C. Lane <bcl@redhat.com> | 2018-10-17 11:28:18 -0700 |
---|---|---|
committer | Brian C. Lane <bcl@redhat.com> | 2019-08-09 11:54:54 -0700 |
commit | 6a39c906d2d2144f0bf59ca488a5d7cc6ffc253e (patch) | |
tree | 10b48cb7bc39c88f9cbddc450c3875c539dad931 | |
parent | 9801693c0f8364f52bb0cbcbf583ad776ffa38fd (diff) | |
download | parted-6a39c906d2d2144f0bf59ca488a5d7cc6ffc253e.tar.gz |
Remove unnecessary if before free checks
Caught by make syntax-check
-rw-r--r-- | libparted/labels/fdasd.c | 12 | ||||
-rw-r--r-- | parted/parted.c | 13 |
2 files changed, 8 insertions, 17 deletions
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c index 713ed6b..cee4d46 100644 --- a/libparted/labels/fdasd.c +++ b/libparted/labels/fdasd.c @@ -111,14 +111,10 @@ fdasd_cleanup (fdasd_anchor_t *anchor) if (anchor == NULL) return; - if (anchor->f4 != NULL) - free(anchor->f4); - if (anchor->f5 != NULL) - free(anchor->f5); - if (anchor->f7 != NULL) - free(anchor->f7); - if (anchor->vlabel != NULL) - free(anchor->vlabel); + free(anchor->f4); + free(anchor->f5); + free(anchor->f7); + free(anchor->vlabel); part_info = anchor->first; for (i = 1; i <= USABLE_PARTITIONS && part_info != NULL; i++) { diff --git a/parted/parted.c b/parted/parted.c index fe7c26d..25633bf 100644 --- a/parted/parted.c +++ b/parted/parted.c @@ -799,12 +799,10 @@ do_mkpart (PedDevice** dev, PedDisk** diskp) "aligned for best performance: %s"), align_err ? align_err : _("unknown (malloc failed)")) == PED_EXCEPTION_CANCEL) { - if (align_err) - free(align_err); + free(align_err); /* undo partition addition */ goto error_remove_part; } - if (align_err) free(align_err); } } else { @@ -848,8 +846,7 @@ error_remove_part: error_destroy_simple_constraints: ped_partition_destroy (part); error: - if (part_name) - free (part_name); + free (part_name); if (range_start != NULL) ped_geometry_destroy (range_start); if (range_end != NULL) @@ -1714,8 +1711,7 @@ do_align_check (PedDevice **dev, PedDisk** diskp) /* Don't print the error in script mode */ if (opt_script_mode) { - if (align_err) - free(align_err); + free(align_err); return aligned ? 1 : 0; } @@ -1726,8 +1722,7 @@ do_align_check (PedDevice **dev, PedDisk** diskp) part->num, align_err ? align_err : _("unknown (malloc failed)")); - if (align_err) - free(align_err); + free(align_err); /* Always return 1 in interactive mode, to be consistent with the other modes. */ |