[xf86-video-intel] pI830->memory_manager is freed twice
keithp at keithp.com
Mon Oct 8 18:23:31 PDT 2007
Just want to get feedback on whether this will create some kind of nasty
leak. I was trashing the libc memory allocator with a double free before
I did this...
Author: Keith Packard <keithp at koto.keithp.com>
Date: Mon Oct 8 18:22:10 2007 -0700
Leave freeing pI830->memory_manager until we're done with it.
pI830->memory_manager is the DRM memory management segment, and is used
while cleaning up the X server memory allocations. Freeing it before the
rest of the memory allocator is cleaned up turns out to be a bad idea.
diff --git a/src/i830_memory.c b/src/i830_memory.c
index cdb7c47..5fc2043 100644
@@ -267,10 +267,20 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
I830Ptr pI830 = I830PTR(pScrn);
+ i830_memory *mem, *this;
/* While there is any memory between the start and end markers, free it. */
- while (pI830->memory_list->next->next != NULL)
- i830_free_memory(pScrn, pI830->memory_list->next);
+ for (mem = pI830->memory_list->next; mem->next != NULL;)
+ this = mem;
+ mem = mem->next;
+ /* Don't free the DRI memory manager segment; that is still needed */
+ if (this == pI830->memory_manager)
+ i830_free_memory(pScrn, this);
/* Free any allocations in buffer objects */
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: This is a digitally signed message part
More information about the xorg