parted/0095-parted.c-Always-free-peek_word.patch
Brian C. Lane 8f615e462d - Read NVMe model names from sysfs (dann.frazier)
- Fix warnings from GCC 7's -Wimplicit-fallthrough (dann.frazier)
- ped_unit_get_name: Resolve conflicting attributes 'const' and 'pure' (dann.frazier)
- Add udf to t1700-probe-fs and to the manpage (bcl)
- libparted: Add support for MBR id, GPT GUID and detection of UDF filesystem (pali.rohar)
- Fix potential command line buffer overflow (xu.simon)
- t6100-mdraid-partitions: Use v0.90 metadata for the test (bcl)
- parted.c: Make sure dev_name is freed (bcl)
- parted.c: Always free peek_word (bcl)
- Fix the length of several strncpy calls (bcl)
2018-10-16 15:38:03 -07:00

36 lines
1.2 KiB
Diff

From b260c3354d5e9318321c2fc482724870fd9b2740 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 23 Jul 2018 15:12:38 -0700
Subject: [PATCH 095/103] parted.c: Always free peek_word
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 267c346..0dc38c3 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]) || 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.2