From f8f0d1a1d919bbaec89dbc44e7704cdf8ebd6662 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 29 Apr 2024 16:58:59 -0400 Subject: [PATCH] * 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. --- src/cache/ftcmru.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/cache/ftcmru.c b/src/cache/ftcmru.c index a767fa408..f908eb25a 100644 --- a/src/cache/ftcmru.c +++ b/src/cache/ftcmru.c @@ -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++;