Fix the memory leak when find_cached_by_id called many times