scandir
fix leaks