From 26d5f517953bf75c98786168368c8a025507c39b Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Fri, 19 Feb 2010 15:50:53 +0900 Subject: [PATCH] s5pc110 lcd: add safety checks (whether it's malloc'd or not) --- common/lcd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/lcd.c b/common/lcd.c index fef17eb..8a70628 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -854,6 +854,7 @@ static void *lcd_logo (void) #ifdef CONFIG_SPLASH_SCREEN char *s; ulong addr; + int allocated = 0; static int do_splash = 1; if (do_splash && (s = getenv("splashimage")) != NULL) { @@ -884,18 +885,20 @@ static void *lcd_logo (void) if (!((bmp->header.signature[0]=='B') && (bmp->header.signature[1]=='M'))) { addr = (ulong)gunzip_bmp(addr, &len); + if (addr) + allocated = 1; } #endif if (lcd_display_bitmap (addr, x, y) == 0) { #ifdef CONFIG_VIDEO_BMP_GZIP - if (addr) + if (addr && allocated) free((void *)addr); #endif return ((void *)lcd_base); } #ifdef CONFIG_VIDEO_BMP_GZIP - if (addr) + if (addr && allocated) free((void *)addr); #endif } -- 2.7.4