From e59b7857f88e3aac8a9a8e516aa9bf2079000ceb Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 13 Dec 2011 19:53:57 +0100 Subject: [PATCH] * grub-core/commands/videotest.c (grub_cmd_videotest): Check that allocation succeeded. --- ChangeLog | 5 +++++ grub-core/commands/videotest.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 833d80a8a..7ea8d1001 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-12-13 Vladimir Serbinenko + + * grub-core/commands/videotest.c (grub_cmd_videotest): Check that + allocation succeeded. + 2011-12-13 Vladimir Serbinenko * grub-core/fs/iso9660.c (grub_iso9660_convert_string): Make first diff --git a/grub-core/commands/videotest.c b/grub-core/commands/videotest.c index dc7a6485f..11949a6fc 100644 --- a/grub-core/commands/videotest.c +++ b/grub-core/commands/videotest.c @@ -74,6 +74,8 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)), grub_video_create_render_target (&text_layer, width, height, GRUB_VIDEO_MODE_TYPE_RGB | GRUB_VIDEO_MODE_TYPE_ALPHA); + if (!text_layer) + goto fail; grub_video_set_active_render_target (text_layer); @@ -191,6 +193,11 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)), grub_errno = GRUB_ERR_NONE; return grub_errno; + + fail: + grub_video_delete_render_target (text_layer); + grub_video_restore (); + return grub_errno; } static grub_command_t cmd;