Avoiding leaving the socket open when an error occurs in multistream connect.

This commit is contained in:
Jose Marcial Vieira Bisneto 2017-07-06 22:09:38 -03:00
parent e4ba343d48
commit e51643a8f4

View file

@ -171,6 +171,8 @@ struct Stream* libp2p_net_multistream_connect(const char* hostname, int port) {
libp2p_net_multistream_stream_free(stream);
stream = NULL;
}
if (retVal < 0 && socket > 0)
close(socket);
return stream;
}