From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TQH6z-0000jZ-Br for mharc-grub-devel@gnu.org; Mon, 22 Oct 2012 08:28:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQH6p-0000jN-8j for grub-devel@gnu.org; Mon, 22 Oct 2012 08:28:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TQH6j-00016N-GD for grub-devel@gnu.org; Mon, 22 Oct 2012 08:27:55 -0400 Received: from service87.mimecast.com ([91.220.42.44]:39133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQH6j-00015D-6q for grub-devel@gnu.org; Mon, 22 Oct 2012 08:27:49 -0400 Received: from emea-cam-gw1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) (Using TLS) by service87.mimecast.com; Mon, 22 Oct 2012 13:27:46 +0100 Received: from [10.1.69.77] (10.1.2.13) by emea-cam-gw1.Emea.Arm.com (10.1.248.203) with Microsoft SMTP Server id 8.2.254.0; Mon, 22 Oct 2012 13:27:44 +0100 Message-ID: <50853BBE.2010703@arm.com> Date: Mon, 22 Oct 2012 13:27:42 +0100 From: Leif Lindholm User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: [PATCH] grub-mkimage: postpone free(arguments.output) X-MC-Unique: 112102213274600601 Content-Type: multipart/mixed; boundary="------------070506070805080307000203" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 91.220.42.44 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Oct 2012 12:28:03 -0000 --------------070506070805080307000203 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable 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. --------------070506070805080307000203 Content-Type: text/x-patch; name=grub-mkimage-postpone-free.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="grub-mkimage-postpone-free.patch" =3D=3D=3D modified file 'util/grub-mkimage.c' --- util/grub-mkimage.c=092012-06-26 01:38:10 +0000 +++ util/grub-mkimage.c=092012-10-22 12:13:38 +0000 @@ -1862,7 +1862,6 @@ if (! fp) =09grub_util_error (_("cannot open `%s': %s"), arguments.output, =09=09=09 strerror (errno)); - free (arguments.output); } =20 if (!arguments.dir) @@ -1889,5 +1888,8 @@ if (arguments.dir) free (arguments.dir); =20 + if (arguments.output) + free (arguments.output); + return 0; } --------------070506070805080307000203--