* grub-core/commands/videotest.c (grub_cmd_videotest): Fix error

handling when creating text_layer failed.
	* grub-core/video/video.c (grub_video_create_render_target):
	Set result to 0 on error.
	(grub_video_delete_render_target): Do not dereference NULL.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-04-19 15:09:15 +02:00
parent aeace7f71c
commit 386497990a
3 changed files with 15 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2013-04-19 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/videotest.c (grub_cmd_videotest): Fix error
handling when creating text_layer failed.
* grub-core/video/video.c (grub_video_create_render_target):
Set result to 0 on error.
(grub_video_delete_render_target): Do not dereference NULL.
2013-04-19 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/elfXX.c (grub_elfXX_load): Handle

View file

@ -71,10 +71,10 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
grub_font_t fixed;
struct grub_font_glyph *glyph;
grub_video_create_render_target (&text_layer, width, height,
GRUB_VIDEO_MODE_TYPE_RGB
| GRUB_VIDEO_MODE_TYPE_ALPHA);
if (!text_layer)
if (grub_video_create_render_target (&text_layer, width, height,
GRUB_VIDEO_MODE_TYPE_RGB
| GRUB_VIDEO_MODE_TYPE_ALPHA)
|| !text_layer)
goto fail;
grub_video_set_active_render_target (text_layer);

View file

@ -339,6 +339,7 @@ grub_video_create_render_target (struct grub_video_render_target **result,
unsigned int width, unsigned int height,
unsigned int mode_type)
{
*result = 0;
if (! grub_video_adapter_active)
return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
@ -351,6 +352,8 @@ grub_video_create_render_target (struct grub_video_render_target **result,
grub_err_t
grub_video_delete_render_target (struct grub_video_render_target *target)
{
if (!target)
return GRUB_ERR_NONE;
if (! grub_video_adapter_active)
return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");