From d47a9c22d29f5237a0ecf981c70e55bb9c6a73c6 Mon Sep 17 00:00:00 2001
From: Leif Lindholm <leif.lindholm@arm.com>
Date: Sun, 20 Jan 2013 23:16:34 +0000
Subject: [PATCH 124/482] * util/grub-mkimage.c (main): Postpone freeing
arguments.output until after its use in generate_image.
---
ChangeLog | 5 +++++
util/grub-mkimage.c | 4 +++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 6886f29..10c094b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-20 Leif Lindholm <leif.lindholm@arm.com>
+
+ * util/grub-mkimage.c (main): Postpone freeing arguments.output
+ until after its use in generate_image.
+
2013-01-20 Colin Watson <cjwatson@ubuntu.com>
* grub-core/loader/i386/linux.c (grub_cmd_initrd): Don't add the
diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c
index d0eecf2..29bda17 100644
--- a/util/grub-mkimage.c
+++ b/util/grub-mkimage.c
@@ -1905,7 +1905,6 @@ main (int argc, char *argv[])
if (! fp)
grub_util_error (_("cannot open `%s': %s"), arguments.output,
strerror (errno));
- free (arguments.output);
}
if (!arguments.dir)
@@ -1933,5 +1932,8 @@ main (int argc, char *argv[])
if (arguments.dir)
free (arguments.dir);
+ if (arguments.output)
+ free (arguments.output);
+
return 0;
}
--
1.8.2.1