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