Dear Luigi Mantellini,

In message <aanlkti=kq+zc7yvue5ssc=wzzuwecpmyqhq-c-hz0...@mail.gmail.com> you 
wrote:
>
> 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 received warning from my debugger during activities on other things,
> and I added this fix to my code to turn-off "possible free on null
> pointer" warning from my debugger.

free(NULL) has a well defined behaviour: "If ptr is NULL, no
operation is performed."

Seems your debugger is over-cautious.  This may be OK for debugging,
but is no good reason to change the code.

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: w...@denx.de
It is easier to change the specification to fit the program than vice
versa.
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to