summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2021-06-10 15:55:59 -0700
committerBrian C. Lane <bcl@redhat.com>2021-06-11 13:47:36 -0700
commit6c4050af2c6c0abdbe1d553fdf2f19a6b600e9d1 (patch)
tree5dc71caf52a549b53a2f3b95e3bd2a64b4ff69d8
parentfbd83d9df7bf5fd0c830935decb9bbc482bf95f4 (diff)
downloadparted-6c4050af2c6c0abdbe1d553fdf2f19a6b600e9d1.tar.gz
parted: Fix memory leaks in do_resizepart
-rw-r--r--parted/parted.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/parted/parted.c b/parted/parted.c
index ba152c3..22b5818 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1582,7 +1582,6 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
/* Push the End value back onto the command_line, if it exists */
if (end_size) {
command_line_push_word(end_size);
- free(end_size);
}
start = part->geom.start;
@@ -1590,7 +1589,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
goto error;
_adjust_end_if_iec(&start, &end, range_end, end_input);
- free(end_input);
+
/* Do not move start of the partition */
constraint = constraint_from_start_end_fixed_start (*dev, start, range_end);
if (!ped_disk_set_partition_geom (disk, part, constraint,
@@ -1616,6 +1615,9 @@ error_destroy_constraint:
error:
if (range_end != NULL)
ped_geometry_destroy (range_end);
+ free(end_input);
+ free(end_size);
+
return rc;
}