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

Luigi Mantellini luigi.mantellini.ml at gmail.com
Mon Dec 6 10:47:21 CET 2010


Hi Joakim,

We have not "ton" but just two points to fix. 1) when free dict before
to allocate another one, and 2) when free probs before to allocate
another one. These scenarios are not used into u-boot code, because
the library is "one shot" and the other free are called (if called)
just to deallocate all structures (that are surely not null).

best regards,

luigi

On Mon, Dec 6, 2010 at 10:38 AM, Joakim Tjernlund
<joakim.tjernlund at transmode.se> wrote:
>>
>> 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
>
>



-- 
Luigi 'Comio' Mantellini
R&D - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy

Tel.: +39 02 5167 2813
Fax: +39 02 5167 2459
web: www.idf-hit.com
mail: luigi.mantellini at idf-hit.com


More information about the U-Boot mailing list