public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@enneenne.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] video: Add missing free for logo memory
Date: Mon, 21 Apr 2008 09:47:49 +0200	[thread overview]
Message-ID: <20080421074748.GA11596@enneenne.com> (raw)
In-Reply-To: <200804181628.46905.matthias.fuchs@esd-electronics.com>

On Fri, Apr 18, 2008 at 04:28:46PM +0200, Matthias Fuchs wrote:
> This patch adds some missing free()s and does some coding style clean up.

Please, separate the patches or just send the one which fixes memory
allocation only.

> Signed-off-by: Matthias Fuchs <matthias.fuchs@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);

Do you need checking for dst==NULL? (see below)

>  			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);

Maybe you don't need checking for dst==NULL... (see above)

>  		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);

Ditto.

> -	}
>  #endif
>  
> -	return (0);
> +	return 0;
>  }
>  #endif
>  
> -- 
> 1.5.3

Thanks,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti at enneenne.com
Linux Device Driver                             giometti at linux.it
Embedded Systems                     phone:	+39 349 2432127
UNIX programming                     skype:     rodolfo.giometti

  reply	other threads:[~2008-04-21  7:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18 14:28 [U-Boot-Users] [PATCH] video: Add missing free for logo memory Matthias Fuchs
2008-04-21  7:47 ` Rodolfo Giometti [this message]
2008-04-21  8:51   ` Matthias Fuchs
2008-04-21  8:58   ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080421074748.GA11596@enneenne.com \
    --to=giometti@enneenne.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox