Fix a memory leak in ssl3_get_certificate_request.

Found by libFuzzer.

Change-Id: Ifa343a184cc65f71fb6591d290b2d47d24a2be80
Reviewed-on: https://boringssl-review.googlesource.com/7456
Reviewed-by: Steven Valdez <svaldez@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
David Benjamin 2016-03-11 19:30:29 -05:00
parent 15c1488b61
commit 6b6e0b2089

View File

@ -1411,6 +1411,7 @@ int ssl3_get_certificate_request(SSL *ssl) {
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE); OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
goto err; goto err;
} }
xn = NULL;
} }
/* we should setup a certificate to return.... */ /* we should setup a certificate to return.... */
@ -1422,6 +1423,7 @@ int ssl3_get_certificate_request(SSL *ssl) {
ret = 1; ret = 1;
err: err:
X509_NAME_free(xn);
sk_X509_NAME_pop_free(ca_sk, X509_NAME_free); sk_X509_NAME_pop_free(ca_sk, X509_NAME_free);
return ret; return ret;
} }