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

yamux
Jose Marcial Vieira Bisneto 2017-07-06 22:09:38 -03:00
parent e4ba343d48
commit e51643a8f4
1 changed files with 2 additions and 0 deletions

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;
}