I haven't been able to trace why/when tmp becomes NULL,
but at least one user has encountered this condition.
Thus add protection against deferencing a NULL pointer.
/* TODO: check logic here */
do {
tmp = loop->next;
+ if ( tmp ) {
if ( strncmp(tmp->key, key, len) == 0 )
{
cache_remove(tmp->key);
}
else
loop = tmp;
-
+ } else
+ loop = NULL;
} while ( loop && (loop != queue_tail || tmp == NULL) );
/* loop thru list, looking for the one, compare first whatever chars */