mirror of
https://github.com/openssl/openssl.git
synced 2026-01-18 17:11:31 +01:00
Fix a memory leak in sctp code
There is a memory leak of the addrinfo struct when `./openssl s_server -dtls -sctp -accept 127.0.0.1:4433` is used, but `sysctl -w net.sctp.auth_enable=1` is not done before. Additionally this fixes an oversight, when `./openssl s_client -dtls -sctp -connect localhost:4433` is used to connect to above server. The first connect attempt is to IPv6 ::1, which might fail, but the second attempt might still succeed, so continue to try all addesses even when the SCTP socket fails for one of them. Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Paul Yang <paulyang.inf@gmail.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/29541)
This commit is contained in:
committed by
Neil Horman
parent
7e05e8d6a3
commit
c0a7890b62
@@ -156,7 +156,7 @@ int init_client(int *sock, const char *host, const char *port,
|
||||
if (tmpbio == NULL) {
|
||||
BIO_closesocket(*sock);
|
||||
*sock = INVALID_SOCKET;
|
||||
goto out;
|
||||
continue;
|
||||
}
|
||||
BIO_free(tmpbio);
|
||||
}
|
||||
@@ -380,6 +380,7 @@ int do_server(int *accept_sock, const char *host, const char *port,
|
||||
BIO *tmpbio = BIO_new_dgram_sctp(asock, BIO_NOCLOSE);
|
||||
|
||||
if (tmpbio == NULL) {
|
||||
BIO_ADDRINFO_free(res);
|
||||
BIO_closesocket(asock);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
|
||||
Reference in New Issue
Block a user