* [U-Boot-Users] [PATCH] video: Add missing free for logo memory
@ 2008-04-18 14:28 Matthias Fuchs
2008-04-21 7:47 ` Rodolfo Giometti
0 siblings, 1 reply; 4+ messages in thread
From: Matthias Fuchs @ 2008-04-18 14:28 UTC (permalink / raw)
To: u-boot
This patch adds some missing free()s and does some coding style clean up.
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);
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
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot-Users] [PATCH] video: Add missing free for logo memory
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
2008-04-21 8:51 ` Matthias Fuchs
2008-04-21 8:58 ` Wolfgang Denk
0 siblings, 2 replies; 4+ messages in thread
From: Rodolfo Giometti @ 2008-04-21 7:47 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 4+ messages in thread* [U-Boot-Users] [PATCH] video: Add missing free for logo memory
2008-04-21 7:47 ` Rodolfo Giometti
@ 2008-04-21 8:51 ` Matthias Fuchs
2008-04-21 8:58 ` Wolfgang Denk
1 sibling, 0 replies; 4+ messages in thread
From: Matthias Fuchs @ 2008-04-21 8:51 UTC (permalink / raw)
To: u-boot
On Monday 21 April 2008 09:47, Rodolfo Giometti wrote:
> 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.
Please see my comments below. I will resubmit the patch. But w/o the cleanup.
Matthias
>
> > 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)
No, not here!
>
> > 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)
You need it! But I forgot to add the #ifdef CONFIG_VIDEO_BMP_GZIP.
>
> > 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
>
^ permalink raw reply [flat|nested] 4+ messages in thread* [U-Boot-Users] [PATCH] video: Add missing free for logo memory
2008-04-21 7:47 ` Rodolfo Giometti
2008-04-21 8:51 ` Matthias Fuchs
@ 2008-04-21 8:58 ` Wolfgang Denk
1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2008-04-21 8:58 UTC (permalink / raw)
To: u-boot
In message <20080421074748.GA11596@enneenne.com> you wrote:
> 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.
In principle you are right, but I think this is still acceptable.
Please turn a blind eye...
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Beware of bugs in the above code; I have only proved it correct, not
tried it." - Donald Knuth
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-21 8:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2008-04-21 8:51 ` Matthias Fuchs
2008-04-21 8:58 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox