* grub-core/io/gzio.c (huft_build): Use zalloc for safety.

(initialize_tables): reset tl and td to NULL after freeing.
This commit is contained in:
Vladimir Serbinenko 2013-10-30 11:58:00 +01:00
parent 93c120754a
commit a602dc5425
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2013-10-30 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/io/gzio.c (huft_build): Use zalloc for safety.
(initialize_tables): reset tl and td to NULL after freeing.
2013-10-28 Vladimir Serbinenko <phcoder@gmail.com> 2013-10-28 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/multiboot_mbi2.c: Implement network tag. * grub-core/loader/multiboot_mbi2.c: Implement network tag.

View file

@ -544,7 +544,7 @@ huft_build (unsigned *b, /* code lengths in bits (all assumed <= BMAX) */
z = 1 << j; /* table entries for j-bit table */ z = 1 << j; /* table entries for j-bit table */
/* allocate and link in new table */ /* allocate and link in new table */
q = (struct huft *) grub_malloc ((z + 1) * sizeof (struct huft)); q = (struct huft *) grub_zalloc ((z + 1) * sizeof (struct huft));
if (! q) if (! q)
{ {
if (h) if (h)
@ -1118,6 +1118,8 @@ initialize_tables (grub_gzio_t gzio)
/* Reset memory allocation stuff. */ /* Reset memory allocation stuff. */
huft_free (gzio->tl); huft_free (gzio->tl);
huft_free (gzio->td); huft_free (gzio->td);
gzio->tl = NULL;
gzio->td = NULL;
} }