grub2/0247-util-grub-install-rearrange-code-to-avoid-memory-lea.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

40 lines
891 B
Diff

From be0743b052d76c27cc704d94cfd38cc54e7e02b3 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Mon, 26 Jan 2015 22:17:31 +0300
Subject: [PATCH 247/506] util/grub-install: rearrange code to avoid memory
leak.
Found by: Coverity scan.
---
util/grub-install.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/util/grub-install.c b/util/grub-install.c
index afbc557..210f4a7 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -615,17 +615,14 @@ device_map_check_duplicates (const char *dev_map)
char **d;
size_t i;
- d = xmalloc (alloced * sizeof (d[0]));
-
if (dev_map[0] == '\0')
return;
fp = grub_util_fopen (dev_map, "r");
if (! fp)
- {
- free (d);
- return;
- }
+ return;
+
+ d = xmalloc (alloced * sizeof (d[0]));
while (fgets (buf, sizeof (buf), fp))
{
--
2.4.3