Skip to contentSkip to conversation

grub-mkimage: postpone free(arguments.output)

PATCH In review Leif Lindholm 2 participants 2 messages Oct 22, 2012 – Jan 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 grub-mkimage: postpone free(arguments.output)

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.

=== modified file 'util/grub-mkimage.c'

grub-mkimage.c +3 -1
@@ -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;
 }
#1 lore raw
Quoted 4 lines · Leif Lindholm

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.

Signature · 1 line
Colin Watson                                       [[email protected]]