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
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] Patch to fix calls to _AL_FREE(0) in src/config.c (4.3.10)
- From: Chris Robinson <chris.kcat@xxxxxxxxxx>
- Date: Wed, 24 Sep 2008 23:06:42 -0700
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."