mirror of
https://github.com/nginx/nginx.git
synced 2024-11-27 23:49:00 +08:00
fix memory leak when ssl_verify_client is on
This commit is contained in:
parent
b39b9aa59a
commit
58d3821cf0
@ -288,7 +288,7 @@ ngx_http_ssl_verify_callback(int ok, X509_STORE_CTX *x509_store)
|
||||
char *subject, *issuer;
|
||||
int err, depth;
|
||||
X509 *cert;
|
||||
X509_NAME *name;
|
||||
X509_NAME *sname, *iname;
|
||||
ngx_connection_t *c;
|
||||
ngx_ssl_conn_t *ssl_conn;
|
||||
|
||||
@ -301,17 +301,25 @@ ngx_http_ssl_verify_callback(int ok, X509_STORE_CTX *x509_store)
|
||||
err = X509_STORE_CTX_get_error(x509_store);
|
||||
depth = X509_STORE_CTX_get_error_depth(x509_store);
|
||||
|
||||
name = X509_get_subject_name(cert);
|
||||
subject = name ? X509_NAME_oneline(name, NULL, 0) : "(none)";
|
||||
sname = X509_get_subject_name(cert);
|
||||
subject = sname ? X509_NAME_oneline(sname, NULL, 0) : "(none)";
|
||||
|
||||
name = X509_get_issuer_name(cert);
|
||||
issuer = name ? X509_NAME_oneline(name, NULL, 0) : "(none)";
|
||||
iname = X509_get_issuer_name(cert);
|
||||
issuer = iname ? X509_NAME_oneline(iname, NULL, 0) : "(none)";
|
||||
|
||||
ngx_log_debug5(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
||||
"verify:%d, error:%d, depth:%d, "
|
||||
"subject:\"%s\",issuer: \"%s\"",
|
||||
ok, err, depth, subject, issuer);
|
||||
|
||||
if (sname) {
|
||||
OPENSSL_free(subject);
|
||||
}
|
||||
|
||||
if (iname) {
|
||||
OPENSSL_free(issuer);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user