Fix the memory leaks problem.

Add multi efree invokes for fully avoid the memory leak problem occurs
by monip_getbyhostname.