[U-Boot] [PATCH] Prevent malloc with size 0

Joakim Tjernlund joakim.tjernlund at transmode.se
Sun Apr 1 14:25:29 CEST 2012


>
> Dear Mike Frysinger,
>
> > On Thursday, October 21, 2010 17:10:31 Graeme Russ wrote:
> > > On 22/10/10 06:51, Mike Frysinger wrote:
> > > > have u-boot return an error.
> > >
> > > Is NULL what you consider to be an error
> >
> > yes
> >
> > > Besides, is not free(NULL) valid (does nothing) as well?
> >
> > yes, free(NULL) should work fine per POSIX
> > -mike
>
> Well then, this patch wasn't accepted yet and I consider it OK to apply. Any
> objections?

There was a long debate on the list regarding this where I argued that
malloc(0) should not be an error and malloc should return a ptr != NULL
I guess that is why it hasn't been applied.

 Jocke



More information about the U-Boot mailing list