47 lines
1.5 KiB
Diff
47 lines
1.5 KiB
Diff
|
From 9acf1c61938c83cf8f68613bacdf872a5f4db632 Mon Sep 17 00:00:00 2001
|
||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||
|
Date: Thu, 10 Jun 2021 15:55:59 -0700
|
||
|
Subject: [PATCH 97/97] parted: Fix memory leaks in do_resizepart
|
||
|
|
||
|
(cherry picked from commit 6c4050af2c6c0abdbe1d553fdf2f19a6b600e9d1)
|
||
|
|
||
|
Related: rhbz#1861804
|
||
|
---
|
||
|
parted/parted.c | 6 ++++--
|
||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/parted/parted.c b/parted/parted.c
|
||
|
index 64fdd54..d4db2b5 100644
|
||
|
--- a/parted/parted.c
|
||
|
+++ b/parted/parted.c
|
||
|
@@ -1572,7 +1572,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;
|
||
|
@@ -1580,7 +1579,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,
|
||
|
@@ -1606,6 +1605,9 @@ error_destroy_constraint:
|
||
|
error:
|
||
|
if (range_end != NULL)
|
||
|
ped_geometry_destroy (range_end);
|
||
|
+ free(end_input);
|
||
|
+ free(end_size);
|
||
|
+
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.31.1
|
||
|
|