Blame SOURCES/0097-parted-Fix-memory-leaks-in-do_resizepart.patch

055a74
From 9acf1c61938c83cf8f68613bacdf872a5f4db632 Mon Sep 17 00:00:00 2001
055a74
From: "Brian C. Lane" <bcl@redhat.com>
055a74
Date: Thu, 10 Jun 2021 15:55:59 -0700
055a74
Subject: [PATCH 97/97] parted: Fix memory leaks in do_resizepart
055a74
055a74
(cherry picked from commit 6c4050af2c6c0abdbe1d553fdf2f19a6b600e9d1)
055a74
055a74
Related: rhbz#1861804
055a74
---
055a74
 parted/parted.c | 6 ++++--
055a74
 1 file changed, 4 insertions(+), 2 deletions(-)
055a74
055a74
diff --git a/parted/parted.c b/parted/parted.c
055a74
index 64fdd54..d4db2b5 100644
055a74
--- a/parted/parted.c
055a74
+++ b/parted/parted.c
055a74
@@ -1572,7 +1572,6 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
055a74
         /* Push the End value back onto the command_line, if it exists */
055a74
         if (end_size) {
055a74
             command_line_push_word(end_size);
055a74
-            free(end_size);
055a74
         }
055a74
 
055a74
         start = part->geom.start;
055a74
@@ -1580,7 +1579,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
055a74
         if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
055a74
                 goto error;
055a74
         _adjust_end_if_iec(&start, &end, range_end, end_input);
055a74
-        free(end_input);
055a74
+
055a74
         /* Do not move start of the partition */
055a74
         constraint = constraint_from_start_end_fixed_start (*dev, start, range_end);
055a74
         if (!ped_disk_set_partition_geom (disk, part, constraint,
055a74
@@ -1606,6 +1605,9 @@ error_destroy_constraint:
055a74
 error:
055a74
         if (range_end != NULL)
055a74
                 ped_geometry_destroy (range_end);
055a74
+        free(end_input);
055a74
+        free(end_size);
055a74
+
055a74
         return rc;
055a74
 }
055a74
 
055a74
-- 
055a74
2.31.1
055a74