Dfs fixbug

dfs_fs.c: fix null pointer bug, optimized redundant loop.