Fix memory error in spl_directory.c