Fix memory leak in SSL_new if errors occur.
(Imported from upstream's 76e6509085ea96df0ca542568ee2596343711307) Change-Id: I6319271a1f46b3d36a4eba950cbab60420126175 Reviewed-on: https://boringssl-review.googlesource.com/2833 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
2adb7ec286
commit
710d227daa
@ -374,13 +374,7 @@ SSL *SSL_new(SSL_CTX *ctx) {
|
||||
|
||||
err:
|
||||
if (s != NULL) {
|
||||
if (s->cert != NULL) {
|
||||
ssl_cert_free(s->cert);
|
||||
}
|
||||
if (s->ctx != NULL) {
|
||||
SSL_CTX_free(s->ctx);
|
||||
}
|
||||
OPENSSL_free(s);
|
||||
SSL_free(s);
|
||||
}
|
||||
OPENSSL_PUT_ERROR(SSL, SSL_new, ERR_R_MALLOC_FAILURE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user