grub2/0232-devmapper-getroot-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

54 lines
1.3 KiB
Diff

From c14dff3ca722cc139cd9c44261aa99882d8a8ca3 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Mon, 26 Jan 2015 09:50:27 +0100
Subject: [PATCH 232/506] devmapper/getroot: Fix memory leak.
Found by: Coverity scan.
---
grub-core/osdep/devmapper/getroot.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/grub-core/osdep/devmapper/getroot.c b/grub-core/osdep/devmapper/getroot.c
index d02386b..0a77a04 100644
--- a/grub-core/osdep/devmapper/getroot.c
+++ b/grub-core/osdep/devmapper/getroot.c
@@ -160,7 +160,10 @@ grub_util_pull_devmapper (const char *os_dev)
uuid = get_dm_uuid (os_dev);
if (!grub_util_open_dm (os_dev, &tree, &node))
- return;
+ {
+ grub_free (uuid);
+ return;
+ }
while ((child = dm_tree_next_child (&handle, node, 0)))
{
@@ -192,6 +195,7 @@ grub_util_pull_devmapper (const char *os_dev)
}
else
dm_tree_free (tree);
+ grub_free (uuid);
}
char *
@@ -253,6 +257,7 @@ grub_util_get_devmapper_grub_dev (const char *os_dev)
grub_free (uuid);
return grub_dev;
}
+ grub_free (uuid);
return NULL;
}
@@ -279,6 +284,7 @@ grub_util_get_vg_uuid (const char *os_dev)
}
optr--;
*optr = '\0';
+ grub_free (uuid);
return vgid;
}
--
2.4.3