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

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