Re: [AD] [4.4]/[4.2] [Windows] Problems with gfx_gdi_init()/gfx_gdi_exit()

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


On 2011-02-21, Andrei Ellman <ae-a-alleg@xxxxxxxxxx> wrote:
> Hi,
> 
> In Windows (using Allegro 4.2.3.1) if I successfully set a graphics mode 
> using the GFX_GDI driver and then set a different mode using GFX_GDI 
> that causes gfx_gdi_init() to fail, then a crash occurs in gfx_gdi_exit().
> 
> When examining wgdi.c, in gfx_gdi_exit() I noticed that 'screen_surf' is 
> not set to NULL once it has been free()'d, which was the cause of the 
> crash (as it was already free()'d on the previous successful removal of 
> that mode). Also, I notice that _AL_FREE(gdi_dirty_lines); and 
> _AL_FREE(screen_surf); don't check to see if the pointer is NULL. 
> Although 'gdi_screen' is set to NULL, none of it's associated 
> datastructures (as allocated in _make_bitmap()) are free()'d, causing a 
> memory-leak. Also, in gfx_gdi_init(), there are no checks done to see if 
> _AL_MALLOC_ATOMIC() or _make_bitmap() return NULL.
> 
> The code of wgdi.c is identical in 4.2.3.1 and 4.4.1.1 so any fix could 
> be applied to both branches.
> 

A patch would be appreciated.

Peter




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