parted/0096-parted.c-Make-sure-dev_name-is-freed.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

46 lines
1.3 KiB
Diff

From c624fe22349912ca8bd1a288d5ccc65b6e346420 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 23 Jul 2018 15:18:37 -0700
Subject: [PATCH 096/103] parted.c: Make sure dev_name is freed
If there was a problem with ped_device_get or ped_device_open it would not be freed.
Related: rhbz#1602652
---
parted/parted.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/parted/parted.c b/parted/parted.c
index 0dc38c3..35432c6 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1101,6 +1101,7 @@ do_print (PedDevice** dev, PedDisk** diskp)
if (has_devices_arg) {
char* dev_name;
PedDevice* current_dev = NULL;
+ int status = 0;
ped_device_probe_all();
@@ -1116,14 +1117,11 @@ do_print (PedDevice** dev, PedDisk** diskp)
ped_device_free_all ();
*dev = ped_device_get (dev_name);
- if (!*dev)
- return 0;
- if (!ped_device_open (*dev))
- return 0;
-
+ if (*dev && ped_device_open (*dev))
+ status = 1;
free (dev_name);
- return 1;
+ return status;
}
else if (has_list_arg)
--
2.17.2