device/oprom/yabel/vbe.c: Fix memory leak

Do not allocate memory if the bootsplash was not found.
Found by Cppcheck 1.65. Fixes:
[src/device/oprom/yabel/vbe.c:734]: (error) Memory leak: decdata

Change-Id: Ie2283165c9d7650dce9baf9e892dd055d44dcce5
Signed-off-by: Daniele Forsi <dforsi@gmail.com>
Reviewed-on: http://review.coreboot.org/6377
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
Daniele Forsi 2014-07-26 11:37:41 +02:00 committed by Edward O'Callaghan
parent f9ce88e942
commit 6e3712f9e1
1 changed files with 1 additions and 1 deletions

View File

@ -719,7 +719,6 @@ void vbe_set_graphics(void)
DEBUG_PRINTF_VBE("FRAMEBUFFER: 0x%p\n", framebuffer); DEBUG_PRINTF_VBE("FRAMEBUFFER: 0x%p\n", framebuffer);
struct jpeg_decdata *decdata; struct jpeg_decdata *decdata;
decdata = malloc(sizeof(*decdata));
/* Switching Intel IGD to 1MB video memory will break this. Who /* Switching Intel IGD to 1MB video memory will break this. Who
* cares. */ * cares. */
@ -736,6 +735,7 @@ void vbe_set_graphics(void)
DEBUG_PRINTF_VBE("Splash at %p ...\n", jpeg); DEBUG_PRINTF_VBE("Splash at %p ...\n", jpeg);
dump(jpeg, 64); dump(jpeg, 64);
decdata = malloc(sizeof(*decdata));
int ret = 0; int ret = 0;
DEBUG_PRINTF_VBE("Decompressing boot splash screen...\n"); DEBUG_PRINTF_VBE("Decompressing boot splash screen...\n");
ret = jpeg_decode(jpeg, framebuffer, 1024, 768, 16, decdata); ret = jpeg_decode(jpeg, framebuffer, 1024, 768, 16, decdata);