diff -r d00a24dd3dee src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c	Tue Oct 17 16:16:37 2017 +0300
+++ b/src/event/ngx_event_openssl.c	Wed Jan 10 21:24:27 2018 +0800
@@ -374,10 +374,12 @@
     BIO         *bio;
     X509        *x509;
     u_long       n;
-    ngx_str_t   *pwd;
+    ngx_str_t   *pwd, cn, kn;
     ngx_uint_t   tries;
 
-    if (ngx_conf_full_name(cf->cycle, cert, 1) != NGX_OK) {
+    cn = *cert;
+
+    if (ngx_conf_full_name(cf->cycle, &cn, 1) != NGX_OK) {
         return NGX_ERROR;
     }
 
@@ -387,30 +389,30 @@
      * it here
      */
 
-    bio = BIO_new_file((char *) cert->data, "r");
+    bio = BIO_new_file((char *) cn.data, "r");
     if (bio == NULL) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
-                      "BIO_new_file(\"%s\") failed", cert->data);
+                      "BIO_new_file(\"%s\") failed", cn.data);
         return NGX_ERROR;
     }
 
     x509 = PEM_read_bio_X509_AUX(bio, NULL, NULL, NULL);
     if (x509 == NULL) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
-                      "PEM_read_bio_X509_AUX(\"%s\") failed", cert->data);
+                      "PEM_read_bio_X509_AUX(\"%s\") failed", cn.data);
         BIO_free(bio);
         return NGX_ERROR;
     }
 
     if (SSL_CTX_use_certificate(ssl->ctx, x509) == 0) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
-                      "SSL_CTX_use_certificate(\"%s\") failed", cert->data);
+                      "SSL_CTX_use_certificate(\"%s\") failed", cn.data);
         X509_free(x509);
         BIO_free(bio);
         return NGX_ERROR;
     }
 
-    if (X509_set_ex_data(x509, ngx_ssl_certificate_name_index, cert->data)
+    if (X509_set_ex_data(x509, ngx_ssl_certificate_name_index, cn.data)
         == 0)
     {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "X509_set_ex_data() failed");
@@ -458,7 +460,7 @@
             /* some real error */
 
             ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
-                          "PEM_read_bio_X509(\"%s\") failed", cert->data);
+                          "PEM_read_bio_X509(\"%s\") failed", cn.data);
             BIO_free(bio);
             return NGX_ERROR;
         }
@@ -474,7 +476,7 @@
         if (SSL_CTX_add0_chain_cert(ssl->ctx, x509) == 0) {
             ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
                           "SSL_CTX_add0_chain_cert(\"%s\") failed",
-                          cert->data);
+                          cn.data);
             X509_free(x509);
             BIO_free(bio);
             return NGX_ERROR;
@@ -484,7 +486,7 @@
         if (SSL_CTX_add_extra_chain_cert(ssl->ctx, x509) == 0) {
             ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
                           "SSL_CTX_add_extra_chain_cert(\"%s\") failed",
-                          cert->data);
+                          cn.data);
             X509_free(x509);
             BIO_free(bio);
             return NGX_ERROR;
@@ -555,7 +557,9 @@
 #endif
     }
 
-    if (ngx_conf_full_name(cf->cycle, key, 1) != NGX_OK) {
+    kn = *key;
+
+    if (ngx_conf_full_name(cf->cycle, &kn, 1) != NGX_OK) {
         return NGX_ERROR;
     }
 
@@ -575,7 +579,7 @@
 
     for ( ;; ) {
 
-        if (SSL_CTX_use_PrivateKey_file(ssl->ctx, (char *) key->data,
+        if (SSL_CTX_use_PrivateKey_file(ssl->ctx, (char *) kn.data,
                                         SSL_FILETYPE_PEM)
             != 0)
         {
@@ -589,7 +593,7 @@
         }
 
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
-                      "SSL_CTX_use_PrivateKey_file(\"%s\") failed", key->data);
+                      "SSL_CTX_use_PrivateKey_file(\"%s\") failed", kn.data);
         return NGX_ERROR;
     }
 
@@ -651,6 +655,8 @@
 ngx_ssl_client_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert,
     ngx_int_t depth)
 {
+    ngx_str_t   cn;
+
     STACK_OF(X509_NAME)  *list;
 
     SSL_CTX_set_verify(ssl->ctx, SSL_VERIFY_PEER, ngx_ssl_verify_callback);
@@ -661,16 +667,18 @@
         return NGX_OK;
     }
 
-    if (ngx_conf_full_name(cf->cycle, cert, 1) != NGX_OK) {
+    cn = *cert;
+
+    if (ngx_conf_full_name(cf->cycle, &cn, 1) != NGX_OK) {
         return NGX_ERROR;
     }
 
-    if (SSL_CTX_load_verify_locations(ssl->ctx, (char *) cert->data, NULL)
+    if (SSL_CTX_load_verify_locations(ssl->ctx, (char *) cn.data, NULL)
         == 0)
     {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
                       "SSL_CTX_load_verify_locations(\"%s\") failed",
-                      cert->data);
+                      cn.data);
         return NGX_ERROR;
     }
 
@@ -681,11 +689,11 @@
 
     ERR_clear_error();
 
-    list = SSL_load_client_CA_file((char *) cert->data);
+    list = SSL_load_client_CA_file((char *) cn.data);
 
     if (list == NULL) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
-                      "SSL_load_client_CA_file(\"%s\") failed", cert->data);
+                      "SSL_load_client_CA_file(\"%s\") failed", cn.data);
         return NGX_ERROR;
     }
 
@@ -706,22 +714,26 @@
 ngx_ssl_trusted_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert,
     ngx_int_t depth)
 {
+    ngx_str_t   cn;
+
     SSL_CTX_set_verify_depth(ssl->ctx, depth);
 
     if (cert->len == 0) {
         return NGX_OK;
     }
 
-    if (ngx_conf_full_name(cf->cycle, cert, 1) != NGX_OK) {
+    cn = *cert;
+
+    if (ngx_conf_full_name(cf->cycle, &cn, 1) != NGX_OK) {
         return NGX_ERROR;
     }
 
-    if (SSL_CTX_load_verify_locations(ssl->ctx, (char *) cert->data, NULL)
+    if (SSL_CTX_load_verify_locations(ssl->ctx, (char *) cn.data, NULL)
         == 0)
     {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
                       "SSL_CTX_load_verify_locations(\"%s\") failed",
-                      cert->data);
+                      cn.data);
         return NGX_ERROR;
     }
 
@@ -739,6 +751,8 @@
 ngx_int_t
 ngx_ssl_crl(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *crl)
 {
+    ngx_str_t     cn;
+
     X509_STORE   *store;
     X509_LOOKUP  *lookup;
 
@@ -746,7 +760,9 @@
         return NGX_OK;
     }
 
-    if (ngx_conf_full_name(cf->cycle, crl, 1) != NGX_OK) {
+    cn = *crl;
+
+    if (ngx_conf_full_name(cf->cycle, &cn, 1) != NGX_OK) {
         return NGX_ERROR;
     }
 
@@ -766,11 +782,11 @@
         return NGX_ERROR;
     }
 
-    if (X509_LOOKUP_load_file(lookup, (char *) crl->data, X509_FILETYPE_PEM)
+    if (X509_LOOKUP_load_file(lookup, (char *) cn.data, X509_FILETYPE_PEM)
         == 0)
     {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
-                      "X509_LOOKUP_load_file(\"%s\") failed", crl->data);
+                      "X509_LOOKUP_load_file(\"%s\") failed", cn.data);
         return NGX_ERROR;
     }
 
@@ -896,12 +912,14 @@
     size_t               len;
     ssize_t              n;
     ngx_fd_t             fd;
-    ngx_str_t           *pwd;
+    ngx_str_t           *pwd, fn;
     ngx_array_t         *passwords;
     ngx_pool_cleanup_t  *cln;
     u_char               buf[NGX_SSL_PASSWORD_BUFFER_SIZE];
 
-    if (ngx_conf_full_name(cf->cycle, file, 1) != NGX_OK) {
+    fn = *file;
+
+    if (ngx_conf_full_name(cf->cycle, &fn, 1) != NGX_OK) {
         return NULL;
     }
 
@@ -915,10 +933,10 @@
     cln->handler = ngx_ssl_passwords_cleanup;
     cln->data = passwords;
 
-    fd = ngx_open_file(file->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
+    fd = ngx_open_file(fn.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
     if (fd == NGX_INVALID_FILE) {
         ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
-                           ngx_open_file_n " \"%s\" failed", file->data);
+                           ngx_open_file_n " \"%s\" failed", fn.data);
         return NULL;
     }
 
@@ -930,7 +948,7 @@
 
         if (n == -1) {
             ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
-                               ngx_read_fd_n " \"%s\" failed", file->data);
+                               ngx_read_fd_n " \"%s\" failed", fn.data);
             passwords = NULL;
             goto cleanup;
         }
@@ -982,7 +1000,7 @@
 
         if (len == NGX_SSL_PASSWORD_BUFFER_SIZE) {
             ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                               "too long line in \"%s\"", file->data);
+                               "too long line in \"%s\"", fn.data);
             passwords = NULL;
             goto cleanup;
         }
@@ -1006,7 +1024,7 @@
 
     if (ngx_close_file(fd) == NGX_FILE_ERROR) {
         ngx_conf_log_error(NGX_LOG_ALERT, cf, ngx_errno,
-                           ngx_close_file_n " \"%s\" failed", file->data);
+                           ngx_close_file_n " \"%s\" failed", fn.data);
     }
 
     ngx_memzero(buf, NGX_SSL_PASSWORD_BUFFER_SIZE);
@@ -1034,28 +1052,31 @@
 ngx_int_t
 ngx_ssl_dhparam(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *file)
 {
-    DH   *dh;
-    BIO  *bio;
+    ngx_str_t    fn;
+    DH          *dh;
+    BIO         *bio;
 
     if (file->len == 0) {
         return NGX_OK;
     }
 
+    fn = *file;
+
     if (ngx_conf_full_name(cf->cycle, file, 1) != NGX_OK) {
         return NGX_ERROR;
     }
 
-    bio = BIO_new_file((char *) file->data, "r");
+    bio = BIO_new_file((char *) fn.data, "r");
     if (bio == NULL) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
-                      "BIO_new_file(\"%s\") failed", file->data);
+                      "BIO_new_file(\"%s\") failed", fn.data);
         return NGX_ERROR;
     }
 
     dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
     if (dh == NULL) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
-                      "PEM_read_bio_DHparams(\"%s\") failed", file->data);
+                      "PEM_read_bio_DHparams(\"%s\") failed", fn.data);
         BIO_free(bio);
         return NGX_ERROR;
     }
@@ -2869,7 +2890,7 @@
     u_char                         buf[80];
     size_t                         size;
     ssize_t                        n;
-    ngx_str_t                     *path;
+    ngx_str_t                     *path, name;
     ngx_file_t                     file;
     ngx_uint_t                     i;
     ngx_array_t                   *keys;
@@ -2889,12 +2910,14 @@
     path = paths->elts;
     for (i = 0; i < paths->nelts; i++) {
 
-        if (ngx_conf_full_name(cf->cycle, &path[i], 1) != NGX_OK) {
+        name = path[i];
+
+        if (ngx_conf_full_name(cf->cycle, &name, 1) != NGX_OK) {
             return NGX_ERROR;
         }
 
         ngx_memzero(&file, sizeof(ngx_file_t));
-        file.name = path[i];
+        file.name = name;
         file.log = cf->log;
 
         file.fd = ngx_open_file(file.name.data, NGX_FILE_RDONLY, 0, 0);
