parted/SOURCES/0086-parted.c-Make-sure-dev_name-is-freed.patch

46 lines
1.3 KiB
Diff
Raw Normal View History

2019-05-07 13:06:40 +00:00
From d68bd3d8afc97c2c9fcf9aab7819c078f4a21290 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 86/86] 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 dae35a5..c95fbbf 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1100,6 +1100,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();
@@ -1115,14 +1116,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.1