Fix socket leak in NODNS code. #4140