+2011-05-14 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Fix few potential memory misusage.
+
+ * grub-core/font/font.c (load_font_index): Don't free char_index to
+ avoid double free.
+
2011-05-14 Vladimir Serbinenko <phcoder@gmail.com>
* docs/grub.texi (Installation): Fix several outdated claims.
return 1;
font->bmp_idx = grub_malloc (0x10000 * sizeof (grub_uint16_t));
if (!font->bmp_idx)
- {
- grub_free (font->char_index);
- return 1;
- }
+ return 1;
grub_memset (font->bmp_idx, 0xff, 0x10000 * sizeof (grub_uint16_t));
#endif
/* Allocate the font object. */
- font = (grub_font_t) grub_malloc (sizeof (struct grub_font));
+ font = (grub_font_t) grub_zalloc (sizeof (struct grub_font));
if (!font)
goto fail;
return 0;
fail:
+ if (file)
+ grub_file_close (file);
+ if (font)
+ font->file = 0;
+
free_font (font);
return 1;
}
grub_free (font->name);
grub_free (font->family);
grub_free (font->char_index);
+ grub_free (font->bmp_idx);
grub_free (font);
}
}