(5) fix foo_mem_clean() functions to avoid race cond.