Fix double-free introduced by commit 33d02a42d6

To reproduce the problem, make sure you have a GPG public key available, build and install GRUB:
grub-install --debug --debug-image="all" --pubkey=/boot/pubkey.gpg --modules="serial terminfo gzio search search_label search_fs_uuid search_fs_file linux vbe video_fb video mmap relocator verify gcry_rsa gcry_dsa gcry_sha256 hashsum gcry_sha1 mpi echo loadenv boottime" /dev/sda
Sign all the files in /boot/grub/* and reboot.

'make check' results identical before and after this change.

TESTED: In a QEMU VM using an i386 target.
This commit is contained in:
Jon McCune 2013-12-13 08:47:12 -08:00
parent d6c2782a90
commit 24d5934daa
5 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2013-12-17 Jon McCune <jonmccune@google.com>
Fix double-free introduced by commit 33d02a42d64cf06cada1c389
2013-12-17 Vladimir Serbinenko <phcoder@gmail.com>
Unify message for unsupported relocation.

View File

@ -885,6 +885,7 @@ grub_pubkey_open (grub_file_t io, const char *filename)
if (err)
return NULL;
io->device = 0;
io->name = 0;
grub_file_close (io);
return ret;
}

View File

@ -1275,6 +1275,7 @@ grub_gzio_close (grub_file_t file)
/* No need to close the same device twice. */
file->device = 0;
file->name = 0;
return grub_errno;
}

View File

@ -525,6 +525,7 @@ grub_lzopio_close (grub_file_t file)
/* Device must not be closed twice. */
file->device = 0;
file->name = 0;
return grub_errno;
}

View File

@ -319,6 +319,7 @@ grub_xzio_close (grub_file_t file)
/* Device must not be closed twice. */
file->device = 0;
file->name = 0;
return grub_errno;
}