Re: [AD] Memory handling problems in 4.3.10

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


On 2008-09-24, Colin Ward <lists@xxxxxxxxxx> wrote:
> However, occasionally I have problems because of memory being allocated in a
> way that bypasses this mechanism.  A good example is in src/readsmp.c on
> line 61, which is:
> 
> iter->ext = strdup(aext); 
> 
> This is a problem because when it is freed on line 126, it is freed with:
> 
> _AL_FREE(iter->ext);
> 
> So the allocation bypasses _AL_MALLOC so that the allocation is on libc's
> list of cells, but it is not on my _AL_MALLOC's list of cells.  So when you
> call _AL_FREE, it (_AL_FREE) complains about an invalid block being passed
> in.
> 
> There are a few of these small problems throughout the code.  Would you be
> interested in some patches to fix these?

Yes. They are bugs.

> Until now I have hacked the code
> in src but as I am preparing to submit my port to the Allegro svn I need to
> fix them properly.  I propose a _AL_STRDUP macro that gets defined along
> with _AL_MALLOC and _AL_FREE.  Any comments?

Sounds fine to me.

Peter





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