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:
David Benjamin 2015-01-11 20:07:59 -05:00 committed by Adam Langley
parent 2adb7ec286
commit 710d227daa

View File

@ -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);