Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Submitted By: Phil D'Amore (ptdamore)
>Assigned to: Anca Vamanu (anca_vamanu)
Summary: Orphaned list entries in localcache module
There is a corner case when deleting from the hash when the removed item is at the head of a particular hash bucket list.
This tends to cause a problem mostly in the functions localcache_clean and lcache_htable_remove_safe. When these functions find the node to be deleted and it's at the head of the list, the head node is deleted, the entries pointer is NULL'd out, and the code stops right there, leaving any other nodes in that list orphaned forever.
The attached patch changes the structure of the list slightly to have an empty node at the head. This eliminates corner cases in the code that walk/modify the list and also eliminates the memory leaks.
>Comment By: Anca Vamanu (anca_vamanu)
Date: 2009-03-16 18:56
You were right, there was a bug when deleting the head of the list. I did
made a special case for this but instead of setting it to the rest if the
list, I just set it to NULL :).
First, I applied your patch but then decided to keep the initial structure
and fix the bugs.