asan/tsan: fix bug in list implementation