* src/cache/ftcmru.c (FTC_MruList_New): Do not reset nodes.

Resetting of the size nodes can crash, if a parent face purge happens
simultaneously and destroys the node. It is safer to create a new node.
Fixes #1270, reopened with a separate issue.
This commit is contained in:
Alexei Podtelezhnikov 2024-04-29 16:58:59 -04:00
parent 1168b1b5b0
commit f8f0d1a1d9
1 changed files with 2 additions and 21 deletions

23
src/cache/ftcmru.c vendored
View File

@ -242,27 +242,6 @@
FT_Memory memory = list->memory;
if ( list->max_nodes > 0 && list->num_nodes >= list->max_nodes )
{
prev = list->nodes->prev;
FT_ASSERT( prev );
/* try fast reset when available */
if ( list->clazz.node_reset )
{
error = list->clazz.node_reset( prev, key, list->data );
if ( !error )
{
node = prev;
FTC_MruNode_Up( &list->nodes, node );
}
goto Exit;
}
}
/* zero new node in case of node_init failure */
if ( FT_ALLOC( node, list->clazz.node_size ) )
goto Exit;
@ -275,6 +254,8 @@
goto Clean;
}
else if ( list->max_nodes > 0 && list->num_nodes >= list->max_nodes )
prev = list->nodes->prev;
FTC_MruNode_Prepend( &list->nodes, node );
list->num_nodes++;