name = X509_get_subject_name(cert);
if (name == NULL) {
+ X509_free(cert);
return NGX_ERROR;
}
s->data = ngx_palloc(pool, len);
if (s->data == NULL) {
OPENSSL_free(p);
+ X509_free(cert);
return NGX_ERROR;
}
ngx_memcpy(s->data, p, len);
OPENSSL_free(p);
+ X509_free(cert);
return NGX_OK;
}
name = X509_get_issuer_name(cert);
if (name == NULL) {
+ X509_free(cert);
return NGX_ERROR;
}
s->data = ngx_palloc(pool, len);
if (s->data == NULL) {
OPENSSL_free(p);
+ X509_free(cert);
return NGX_ERROR;
}
ngx_memcpy(s->data, p, len);
OPENSSL_free(p);
+ X509_free(cert);
return NGX_OK;
}
bio = BIO_new(BIO_s_mem());
if (bio == NULL) {
+ X509_free(cert);
return NGX_ERROR;
}
s->data = ngx_palloc(pool, len);
if (s->data == NULL) {
BIO_free(bio);
+ X509_free(cert);
return NGX_ERROR;
}
BIO_read(bio, s->data, len);
BIO_free(bio);
+ X509_free(cert);
return NGX_OK;
}
if (c->ssl) {
long rc;
+ X509 *cert;
ngx_http_ssl_srv_conf_t *sscf;
sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
return;
}
- if (SSL_get_peer_certificate(c->ssl->connection)
- == NULL)
- {
+ cert = SSL_get_peer_certificate(c->ssl->connection);
+
+ if (cert == NULL) {
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"client sent no required SSL certificate");
ngx_http_finalize_request(r, NGX_HTTPS_NO_CERT);
return;
}
+
+ X509_free(cert);
}
}