[U-Boot-Users] [PATCH] video: Add missing free for logo memory

Matthias Fuchs matthias.fuchs at esd-electronics.com
Fri Apr 18 16:28:46 CEST 2008


This patch adds some missing free()s and does some coding style clean up.

Signed-off-by: Matthias Fuchs <matthias.fuchs at esd-electronics.com>
---
 drivers/video/cfb_console.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 4f73067..751c2c4 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -830,7 +830,7 @@ int video_display_bitmap (ulong bmp_image, int x, int y)
 		dst = malloc(CFG_VIDEO_LOGO_MAX_SIZE);
 		if (dst == NULL) {
 			printf("Error: malloc in gunzip failed!\n");
-			return(1);
+			return 1;
 		}
 		if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)bmp_image, &len) != 0) {
 			printf ("Error: no valid bmp or bmp.gz image at %lx\n", bmp_image);
@@ -849,6 +849,7 @@ int video_display_bitmap (ulong bmp_image, int x, int y)
 		if (!((bmp->header.signature[0] == 'B') &&
 		      (bmp->header.signature[1] == 'M'))) {
 			printf ("Error: no valid bmp.gz image at %lx\n", bmp_image);
+			free(dst);
 			return 1;
 		}
 #else
@@ -869,6 +870,8 @@ int video_display_bitmap (ulong bmp_image, int x, int y)
 	if (compression != BMP_BI_RGB) {
 		printf ("Error: compression type %ld not supported\n",
 			compression);
+		if (dst)
+			free(dst);
 		return 1;
 	}
 
@@ -1046,12 +1049,11 @@ int video_display_bitmap (ulong bmp_image, int x, int y)
 	}
 
 #ifdef CONFIG_VIDEO_BMP_GZIP
-	if (dst) {
+	if (dst)
 		free(dst);
-	}
 #endif
 
-	return (0);
+	return 0;
 }
 #endif
 
-- 
1.5.3





More information about the U-Boot mailing list