[parted-devel] [PATCH 85/86] parted.c: Always free peek_word

Brian C. Lane bcl at redhat.com
Tue Jul 24 01:26:20 BST 2018


If command_line_get_fs_type failed it would never free it, so put a free
in both branches of the if.

Related: rhbz#1602652
---
 parted/parted.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/parted/parted.c b/parted/parted.c
index b49e1df..dae35a5 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -684,12 +684,13 @@ do_mkpart (PedDevice** dev, PedDisk** diskp)
         if (part_type == PED_PARTITION_EXTENDED
             || (peek_word && isdigit (peek_word[0]))) {
                 fs_type = NULL;
+                free (peek_word);
         } else {
+                free (peek_word);
                 if (!command_line_get_fs_type (_("File system type?"),
                                                &fs_type))
                         goto error;
         }
-        free (peek_word);
 
         if (!command_line_get_sector (_("Start?"), *dev, &start, &range_start, NULL))
                 goto error;
-- 
2.17.1




More information about the parted-devel mailing list