finish dfs.c, ex-3.c and fix a free miss in ex-2.c