freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] Memory problem when freeing cache nodes...


From: Stephen Perry
Subject: [Devel] Memory problem when freeing cache nodes...
Date: Fri, 09 Jul 2004 18:31:56 +0100
User-agent: Mozilla Thunderbird 0.7 (X11/20040615)

Hi - apologies if this problem has been seen before, but I'm using the cache support in FreeType 2.1.8 and am hitting a problem freeing cache nodes. I'm currently using the cache to hold faces, charmaps, glpyphs, and small bitmaps, but have changed the memory allocator to something that will start failing when the resource allocation exceeds a specified limit. The result is that FTC_Cache_NewNode() ends up calling FTC_Manager_FlushN() with a count of 71 and the passed in FTC_Manager has num_nodes equal to 1, and nodes_list points to a single node with next and prev references to itself. I assume that this is all as intended.

The problem is that the for loop in FTC_Manager_FlushN() stashes the previous pointer before calling ftc_node_destroy(), but doesn't check to see if it is the same node as the node that was actually destroyed. This results in us accessing freed data the next time around the loop.

I've worked around this problem (I am also seeing some other memory related problems that I'm currently looking into) by adding a "manager->nodes_list != NULL" check in the for loop condition, but didn't know if there was a better way, or if for some reason this case shouldn't be possible at all.

Any recommendations would be welcome...


Many thanks!


steve.


******************Legal Disclaimer**************************
"This email may contain confidential and privileged material for the sole use of the 
intended recipient.  Any unauthorized review, use or distribution by others is strictly 
prohibited.  If you have received the message in error, please advise the sender by reply 
email address@hidden, and delete the message. Thank you."
************************************************************




reply via email to

[Prev in Thread] Current Thread [Next in Thread]