Fix a valgrind error when the socket dies