Fix memory leaks in the Certificate extensions code

After collecting extensions we must free them again.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2284)
This commit is contained in:
Matt Caswell 2017-01-25 14:45:12 +00:00
parent 0fe2a0af89
commit 5ee289eaf6
2 changed files with 8 additions and 2 deletions

View File

@ -1425,8 +1425,11 @@ MSG_PROCESS_RETURN tls_process_server_certificate(SSL *s, PACKET *pkt)
if (!tls_collect_extensions(s, &extensions, EXT_TLS1_3_CERTIFICATE,
&rawexts, &al)
|| !tls_parse_all_extensions(s, EXT_TLS1_3_CERTIFICATE,
rawexts, x, chainidx, &al))
rawexts, x, chainidx, &al)) {
OPENSSL_free(rawexts);
goto f_err;
}
OPENSSL_free(rawexts);
}
if (!sk_X509_push(sk, x)) {

View File

@ -3061,8 +3061,11 @@ MSG_PROCESS_RETURN tls_process_client_certificate(SSL *s, PACKET *pkt)
if (!tls_collect_extensions(s, &extensions, EXT_TLS1_3_CERTIFICATE,
&rawexts, &al)
|| !tls_parse_all_extensions(s, EXT_TLS1_3_CERTIFICATE,
rawexts, x, chainidx, &al))
rawexts, x, chainidx, &al)) {
OPENSSL_free(rawexts);
goto f_err;
}
OPENSSL_free(rawexts);
}
if (!sk_X509_push(sk, x)) {