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 Wednesday 24 September 2008 10:51:42 pm Colin Ward 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.

man 3 free:
"free() frees the memory space pointed to by ptr, which must have been 
returned by a previous  call  to malloc(), calloc() or realloc().  Otherwise, 
or if free(ptr) has already been called before, undefined behavior occurs.  
If ptr is NULL,  no  operation is performed."




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