Free dup_dp also in case get_diskname_from_path() fails.

Signed-off-by: Andrey Borzenkov <arvidj...@gmail.com>

---
 ChangeLog                    |    5 +++++
 grub-core/disk/efi/efidisk.c |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index e5b71cf..a73d694 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-27  Andrey Borzenkov <arvidj...@gmail.com>
+
+       * 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  <phco...@gmail.com>
 
        * grub-core/fs/xfs.c (grub_xfs_read_block): Fix computation in presence
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
index 98cd226..19c5923 100644
--- a/grub-core/disk/efi/efidisk.c
+++ b/grub-core/disk/efi/efidisk.c
@@ -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);
 
-- 
tg: (4b9ea2e..) u/efi-dup_dp (depends on: master)

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to