Re: [AD] Patch to fix calls to _AL_FREE(0) in src/config.c (4.3.10)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 24/09/2008, you wrote:
> 
>> Please find attached a small patch to fix a problem my memory tracker
>> picked up in 4.3.10.  In src/config.c:config_cleanup() it was trying
>> to free config_argv and argv_buf with _AL_FREE() when they were set to
>> NULL. I assume that _AL_FREE() follows the same semantics as free() so
>> this is therefore illegal.
>
> Standard free() lets you free NULL pointers. It no-ops.

You know you are absolutely right.  For no less than 15 years I've thought
it illegal to pass NULL to free() - I guess someone told me that, and a man
page like malloc() or free() isn't something that you tend to come back to
very often.

And now I know it's legal - who says you can't teach an old dog new tricks? 
:-)

-- 
/-------------------------------------------------------------------\
[Hitman/Code HQ - 6502/z80/68000/604e/80x86/ARM coder - Amiga rulez!]
[VZ-200/VIC-20/MZ-700/c16/c64*10/c128*8/Plus-4/CPC464/CD32/500*2    ]
[600/1000/1200*2/A4000/SNES/N64/Dreamcast/Athlon 1100/AmigaOne      ]
[Assembly Language: The most fun you can have with your clothes on! ]
\-------------------------------------------------------------------/





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/