|
|
9723a8 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
c294fc |
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
|
|
c294fc |
Date: Tue, 7 Jul 2020 22:02:31 -0400
|
|
|
9723a8 |
Subject: [PATCH] udf: Fix memory leak
|
|
|
c294fc |
|
|
|
c294fc |
Fixes: CID 73796
|
|
|
c294fc |
|
|
|
c294fc |
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
|
|
c294fc |
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
|
c294fc |
Reviewed-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
|
|
|
c294fc |
Upstream-commit-id: 8da62d8183c
|
|
|
c294fc |
---
|
|
|
c294fc |
grub-core/fs/udf.c | 17 +++++++++++++----
|
|
|
c294fc |
1 file changed, 13 insertions(+), 4 deletions(-)
|
|
|
c294fc |
|
|
|
c294fc |
diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c
|
|
|
b71686 |
index be41b48f9..6670beb56 100644
|
|
|
c294fc |
--- a/grub-core/fs/udf.c
|
|
|
c294fc |
+++ b/grub-core/fs/udf.c
|
|
|
c294fc |
@@ -965,8 +965,10 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
|
|
c294fc |
return 0;
|
|
|
c294fc |
|
|
|
c294fc |
if (grub_udf_read_icb (dir->data, &dirent.icb, child))
|
|
|
c294fc |
- return 0;
|
|
|
c294fc |
-
|
|
|
c294fc |
+ {
|
|
|
c294fc |
+ grub_free (child);
|
|
|
c294fc |
+ return 0;
|
|
|
c294fc |
+ }
|
|
|
c294fc |
if (dirent.characteristics & GRUB_UDF_FID_CHAR_PARENT)
|
|
|
c294fc |
{
|
|
|
c294fc |
/* This is the parent directory. */
|
|
|
c294fc |
@@ -988,11 +990,18 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
|
|
c294fc |
dirent.file_ident_length,
|
|
|
c294fc |
(char *) raw))
|
|
|
c294fc |
!= dirent.file_ident_length)
|
|
|
c294fc |
- return 0;
|
|
|
c294fc |
+ {
|
|
|
c294fc |
+ grub_free (child);
|
|
|
c294fc |
+ return 0;
|
|
|
c294fc |
+ }
|
|
|
c294fc |
|
|
|
c294fc |
filename = read_string (raw, dirent.file_ident_length, 0);
|
|
|
c294fc |
if (!filename)
|
|
|
c294fc |
- grub_print_error ();
|
|
|
c294fc |
+ {
|
|
|
c294fc |
+ /* As the hook won't get called. */
|
|
|
c294fc |
+ grub_free (child);
|
|
|
c294fc |
+ grub_print_error ();
|
|
|
c294fc |
+ }
|
|
|
c294fc |
|
|
|
c294fc |
if (filename && hook (filename, type, child, hook_data))
|
|
|
c294fc |
{
|