diff --git a/ChangeLog b/ChangeLog index 93fe8be25..6e9abacf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-10-30 Vladimir Serbinenko + + * 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 * grub-core/loader/multiboot_mbi2.c: Implement network tag. diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c index 50dc31ad4..6f93b30e4 100644 --- a/grub-core/io/gzio.c +++ b/grub-core/io/gzio.c @@ -544,7 +544,7 @@ huft_build (unsigned *b, /* code lengths in bits (all assumed <= BMAX) */ z = 1 << j; /* table entries for j-bit 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 (h) @@ -1118,6 +1118,8 @@ initialize_tables (grub_gzio_t gzio) /* Reset memory allocation stuff. */ huft_free (gzio->tl); huft_free (gzio->td); + gzio->tl = NULL; + gzio->td = NULL; }