
The call to fdopen can fail in several ways. The fprintf on the next line will then dereference a NULL-pointer FILE*. Added a NULL-check, closed the socket, returned system error and added a comment about it. Change-Id: I7a6b26aa3c79452b1fdd76af12dfa75da88cbad7