diff --git a/crypto/bio/bio_addr.c b/crypto/bio/bio_addr.c index a80774bbd7cac9a7df672063d1b72401a4fc9236..b1443b30409c3916b09f256d5a512d4f7d5f95df 100644 --- a/crypto/bio/bio_addr.c +++ b/crypto/bio/bio_addr.c @@ -547,8 +547,13 @@ int BIO_parse_hostserv(const char *hostserv, char **host, char **service, *service = NULL; } else { *service = OPENSSL_strndup(p, pl); - if (*service == NULL) + if (*service == NULL) { + if (h != NULL && host != NULL) { + OPENSSL_free(*host); + *host = NULL; + } goto memerr; + } } } diff --git a/crypto/bio/bio_sock.c b/crypto/bio/bio_sock.c index 476cbcc5cef16103ebc4cbbc2a1056259b794869..1a99ece01d7d99fef8c8866873364305ca455a3d 100644 --- a/crypto/bio/bio_sock.c +++ b/crypto/bio/bio_sock.c @@ -222,7 +222,7 @@ int BIO_get_accept_socket(char *host, int bind_mode) return INVALID_SOCKET; if (BIO_sock_init() != 1) - return INVALID_SOCKET; + goto err; if (BIO_lookup(h, p, BIO_LOOKUP_SERVER, AF_UNSPEC, SOCK_STREAM, &res) != 0) goto err;