s5pc110 lcd: add safety checks (whether it's malloc'd or not) JB13_20100219
authorMyungJoo Ham <MyungJoo.Ham@samsung.com>
Fri, 19 Feb 2010 06:50:53 +0000 (15:50 +0900)
committerMyungJoo Ham <MyungJoo.Ham@samsung.com>
Fri, 19 Feb 2010 06:50:53 +0000 (15:50 +0900)
common/lcd.c

index fef17eb..8a70628 100644 (file)
@@ -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
        }