grub2/0265-fs-hfsplus-fix-memory-leak.patch
Peter Jones 8c6b1ac71e Reconcile with upstream once again.
Also include some minor fixes for gcc 5.1.1

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-07-22 09:46:32 -04:00

42 lines
1.1 KiB
Diff

From edc94e4b0bd026bf08861a4f4010a36bec0775cd Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Tue, 27 Jan 2015 21:19:28 +0300
Subject: [PATCH 265/506] fs/hfsplus: fix memory leak.
Found by: Coverity scan.
---
grub-core/fs/hfsplus.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c
index 950d8a1..8f07f85 100644
--- a/grub-core/fs/hfsplus.c
+++ b/grub-core/fs/hfsplus.c
@@ -723,7 +723,10 @@ list_nodes (void *record, void *hook_arg)
/* If the name is obviously invalid, skip this node. */
if (catkey->name[i] == 0)
- return 0;
+ {
+ grub_free (filename);
+ return 0;
+ }
}
*grub_utf16_to_utf8 ((grub_uint8_t *) filename, catkey->name,
@@ -745,7 +748,10 @@ list_nodes (void *record, void *hook_arg)
callback function. */
node = grub_malloc (sizeof (*node));
if (!node)
- return 1;
+ {
+ grub_free (filename);
+ return 1;
+ }
node->data = ctx->dir->data;
node->compressed = 0;
node->cbuf = 0;
--
2.4.3