|
|
a5bd9f6 |
From 56348e90bcc1076de7b2aba73b52fa1bafee4478 Mon Sep 17 00:00:00 2001
|
|
|
a5bd9f6 |
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
Date: Tue, 11 Sep 2012 07:53:26 +0200
|
|
|
a5bd9f6 |
Subject: [PATCH 035/364] * grub-core/disk/diskfilter.c (free_array)
|
|
|
a5bd9f6 |
[GRUB_UTIL]: Fix memory leak. * util/getroot.c (grub_find_device): Likewise.
|
|
|
a5bd9f6 |
(get_mdadm_uuid): Likewise. (grub_util_is_imsm): Likewise.
|
|
|
a5bd9f6 |
(grub_util_pull_device): Likewise. * util/grub-probe.c (probe): Likewise.
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
---
|
|
|
a5bd9f6 |
ChangeLog | 9 +++++++++
|
|
|
a5bd9f6 |
grub-core/disk/diskfilter.c | 3 +++
|
|
|
a5bd9f6 |
util/getroot.c | 13 +++++++++++--
|
|
|
a5bd9f6 |
util/grub-probe.c | 1 +
|
|
|
a5bd9f6 |
4 files changed, 24 insertions(+), 2 deletions(-)
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
diff --git a/ChangeLog b/ChangeLog
|
|
|
a5bd9f6 |
index 6886bcc..c697e17 100644
|
|
|
a5bd9f6 |
--- a/ChangeLog
|
|
|
a5bd9f6 |
+++ b/ChangeLog
|
|
|
a5bd9f6 |
@@ -1,3 +1,12 @@
|
|
|
a5bd9f6 |
+2012-09-11 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
+ * grub-core/disk/diskfilter.c (free_array) [GRUB_UTIL]: Fix memory leak.
|
|
|
a5bd9f6 |
+ * util/getroot.c (grub_find_device): Likewise.
|
|
|
a5bd9f6 |
+ (get_mdadm_uuid): Likewise.
|
|
|
a5bd9f6 |
+ (grub_util_is_imsm): Likewise.
|
|
|
a5bd9f6 |
+ (grub_util_pull_device): Likewise.
|
|
|
a5bd9f6 |
+ * util/grub-probe.c (probe): Likewise.
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
2012-09-10 Benoit Gschwind <gschwind>
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
* grub-core/loader/efi/appleloader.c (devpath_8): New var.
|
|
|
a5bd9f6 |
diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
|
|
|
a5bd9f6 |
index 6e9745e..ce4c706 100644
|
|
|
a5bd9f6 |
--- a/grub-core/disk/diskfilter.c
|
|
|
a5bd9f6 |
+++ b/grub-core/disk/diskfilter.c
|
|
|
a5bd9f6 |
@@ -1130,6 +1130,9 @@ free_array (void)
|
|
|
a5bd9f6 |
grub_disk_close (pv->disk);
|
|
|
a5bd9f6 |
if (pv->id.uuidlen)
|
|
|
a5bd9f6 |
grub_free (pv->id.uuid);
|
|
|
a5bd9f6 |
+#ifdef GRUB_UTIL
|
|
|
a5bd9f6 |
+ grub_free (pv->partmaps);
|
|
|
a5bd9f6 |
+#endif
|
|
|
a5bd9f6 |
grub_free (pv->internal_id);
|
|
|
a5bd9f6 |
grub_free (pv);
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
diff --git a/util/getroot.c b/util/getroot.c
|
|
|
a5bd9f6 |
index e103fb6..b97bea6 100644
|
|
|
a5bd9f6 |
--- a/util/getroot.c
|
|
|
a5bd9f6 |
+++ b/util/getroot.c
|
|
|
a5bd9f6 |
@@ -918,7 +918,10 @@ grub_find_device (const char *dir, dev_t dev)
|
|
|
a5bd9f6 |
grub files */
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
if (strcmp(res, "/dev/root") == 0)
|
|
|
a5bd9f6 |
- continue;
|
|
|
a5bd9f6 |
+ {
|
|
|
a5bd9f6 |
+ free (res);
|
|
|
a5bd9f6 |
+ continue;
|
|
|
a5bd9f6 |
+ }
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
if (chdir (saved_cwd) < 0)
|
|
|
a5bd9f6 |
grub_util_error ("%s", _("cannot restore the original directory"));
|
|
|
a5bd9f6 |
@@ -1363,6 +1366,7 @@ get_mdadm_uuid (const char *os_dev)
|
|
|
a5bd9f6 |
out:
|
|
|
a5bd9f6 |
close (fd);
|
|
|
a5bd9f6 |
waitpid (pid, NULL, 0);
|
|
|
a5bd9f6 |
+ free (buf);
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
return name;
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
@@ -1437,6 +1441,8 @@ grub_util_is_imsm (const char *os_dev)
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
+ free (buf);
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
return 0;
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
out:
|
|
|
a5bd9f6 |
@@ -1577,7 +1583,10 @@ grub_util_pull_device (const char *os_dev)
|
|
|
a5bd9f6 |
char **devicelist = grub_util_raid_getmembers (os_dev, 0);
|
|
|
a5bd9f6 |
int i;
|
|
|
a5bd9f6 |
for (i = 0; devicelist[i];i++)
|
|
|
a5bd9f6 |
- grub_util_pull_device (devicelist[i]);
|
|
|
a5bd9f6 |
+ {
|
|
|
a5bd9f6 |
+ grub_util_pull_device (devicelist[i]);
|
|
|
a5bd9f6 |
+ free (devicelist[i]);
|
|
|
a5bd9f6 |
+ }
|
|
|
a5bd9f6 |
free (devicelist);
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
#endif
|
|
|
a5bd9f6 |
diff --git a/util/grub-probe.c b/util/grub-probe.c
|
|
|
a5bd9f6 |
index 6dd1073..c2a0f62 100644
|
|
|
a5bd9f6 |
--- a/util/grub-probe.c
|
|
|
a5bd9f6 |
+++ b/util/grub-probe.c
|
|
|
a5bd9f6 |
@@ -474,6 +474,7 @@ probe (const char *path, char **device_names, char delim)
|
|
|
a5bd9f6 |
printf ("%s", label);
|
|
|
a5bd9f6 |
putchar (delim);
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
+ grub_device_close (dev);
|
|
|
a5bd9f6 |
goto end;
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
--
|
|
|
a5bd9f6 |
1.8.1.4
|
|
|
a5bd9f6 |
|