Skip to contentSkip to conversation

fix memory leak in grub_efidisk_get_device_name()

PATCH New Andrey Borzenkov 1 participant 1 message Jan 30, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix memory leak in grub_efidisk_get_device_name()

Free dup_dp also in case get_diskname_from_path() fails.

---
 ChangeLog                    |    5 +++++
 grub-core/disk/efi/efidisk.c |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
ChangeLog +5 -0
index e5b71cf..a73d694 100644
@@ -1,3 +1,8 @@
+2013-01-27  Andrey Borzenkov <[email protected]>
+
+	* grub-core/disk/efi/efidisk.c(grub_efidisk_get_device_name): Fix
+	memory leak if device name is not found.
+
 2013-01-30  Vladimir Serbinenko  <[email protected]>
 
 	* grub-core/fs/xfs.c (grub_xfs_read_block): Fix computation in presence
grub-core/disk/efi/efidisk.c +4 -1
index 98cd226..19c5923 100644
@@ -797,7 +797,10 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
       dup_ldp->length[1] = 0;
 
       if (!get_diskname_from_path (dup_dp, device_name))
-	return 0;
+	{
+	  grub_free (dup_dp);
+	  return 0;
+	}
       parent = grub_disk_open (device_name);
       grub_free (dup_dp);
 
Signature · 1 line
tg: (4b9ea2e..) u/efi-dup_dp (depends on: master)