fix memory leak when ssl_verify_client is on
Igor Sysoev
14 years ago
287 | 287 | char *subject, *issuer; |
288 | 288 | int err, depth; |
289 | 289 | X509 *cert; |
290 | X509_NAME *name; | |
290 | X509_NAME *sname, *iname; | |
291 | 291 | ngx_connection_t *c; |
292 | 292 | ngx_ssl_conn_t *ssl_conn; |
293 | 293 | |
300 | 300 | err = X509_STORE_CTX_get_error(x509_store); |
301 | 301 | depth = X509_STORE_CTX_get_error_depth(x509_store); |
302 | 302 | |
303 | name = X509_get_subject_name(cert); | |
304 | subject = name ? X509_NAME_oneline(name, NULL, 0) : "(none)"; | |
305 | ||
306 | name = X509_get_issuer_name(cert); | |
307 | issuer = name ? X509_NAME_oneline(name, NULL, 0) : "(none)"; | |
303 | sname = X509_get_subject_name(cert); | |
304 | subject = sname ? X509_NAME_oneline(sname, NULL, 0) : "(none)"; | |
305 | ||
306 | iname = X509_get_issuer_name(cert); | |
307 | issuer = iname ? X509_NAME_oneline(iname, NULL, 0) : "(none)"; | |
308 | 308 | |
309 | 309 | ngx_log_debug5(NGX_LOG_DEBUG_EVENT, c->log, 0, |
310 | 310 | "verify:%d, error:%d, depth:%d, " |
311 | 311 | "subject:\"%s\",issuer: \"%s\"", |
312 | 312 | ok, err, depth, subject, issuer); |
313 | ||
314 | if (sname) { | |
315 | OPENSSL_free(subject); | |
316 | } | |
317 | ||
318 | if (iname) { | |
319 | OPENSSL_free(issuer); | |
320 | } | |
313 | 321 | |
314 | 322 | return 1; |
315 | 323 | } |