[U-Boot] [PATCH] LZMA: Avoid free on null pointer.

Joakim Tjernlund joakim.tjernlund at transmode.se
Mon Dec 6 10:38:37 CET 2010


>
> On Mon, Dec 6, 2010 at 9:57 AM, Mike Frysinger <vapier at gentoo.org> wrote:
> >
> > sorry, but this is not an acceptable reason.  so unless you have an actual
> > error report here, your patch gets NAK-ed.
> > -mike
> >
>
> Hi mike,
>
> my pov is different: free should (must) be called only on already
> allocated pointers. I know that free code checks at begin if ptr is
> null or not. Anyway I don't understand why a null pointer check before
> to call free cannot be added to the code... it's safe and follows the
> logical flow of the code.

I think you will find this is not the majority view and you will
have to adapt. free(NULL) is fine and the reason for that is so
that you can avoid litter the code with a ton of NULL checks.

    Jocke



More information about the U-Boot mailing list