All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] grub-mkimage: postpone free(arguments.output)
@ 2012-10-22 12:27 Leif Lindholm
  2013-01-20 23:16 ` Colin Watson
  0 siblings, 1 reply; 2+ messages in thread
From: Leif Lindholm @ 2012-10-22 12:27 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

The output filename is currently free()d before the call to generate_image(),
which takes this as a parameter.

This patch delays the free until after generate_image returns.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: grub-mkimage-postpone-free.patch --]
[-- Type: text/x-patch; name=grub-mkimage-postpone-free.patch, Size: 497 bytes --]

=== modified file 'util/grub-mkimage.c'
--- util/grub-mkimage.c	2012-06-26 01:38:10 +0000
+++ util/grub-mkimage.c	2012-10-22 12:13:38 +0000
@@ -1862,7 +1862,6 @@
       if (! fp)
 	grub_util_error (_("cannot open `%s': %s"), arguments.output,
 			 strerror (errno));
-      free (arguments.output);
     }
 
   if (!arguments.dir)
@@ -1889,5 +1888,8 @@
   if (arguments.dir)
     free (arguments.dir);
 
+  if (arguments.output)
+    free (arguments.output);
+
   return 0;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] grub-mkimage: postpone free(arguments.output)
  2012-10-22 12:27 [PATCH] grub-mkimage: postpone free(arguments.output) Leif Lindholm
@ 2013-01-20 23:16 ` Colin Watson
  0 siblings, 0 replies; 2+ messages in thread
From: Colin Watson @ 2013-01-20 23:16 UTC (permalink / raw)
  To: The development of GNU GRUB

On Mon, Oct 22, 2012 at 01:27:42PM +0100, Leif Lindholm wrote:
> The output filename is currently free()d before the call to generate_image(),
> which takes this as a parameter.
> 
> This patch delays the free until after generate_image returns.

Looks correct.  Committed with an added ChangeLog entry; thanks.

-- 
Colin Watson                                       [cjwatson@ubuntu.com]


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-20 23:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-22 12:27 [PATCH] grub-mkimage: postpone free(arguments.output) Leif Lindholm
2013-01-20 23:16 ` Colin Watson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.