aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_uwsgi_module.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2014-04-18 20:13:24 +0400
committerMaxim Dounin <mdounin@mdounin.ru>2014-04-18 20:13:24 +0400
commit93eb94d622093829da4bd4c3e0af16b360e912e4 (patch)
tree1b2edc57acda69d0dfc8f3322a18a1584435ceb9 /src/http/modules/ngx_http_uwsgi_module.c
parent6c9c973aa77b68a9adb1d0814ef5920aaf0ef157 (diff)
downloadnginx-93eb94d622093829da4bd4c3e0af16b360e912e4.tar.gz
nginx-93eb94d622093829da4bd4c3e0af16b360e912e4.zip
Upstream: plugged potential memory leak on reload.
The SSL_CTX_set_cipher_list() may fail if there are no valid ciphers specified in proxy_ssl_ciphers / uwsgi_ssl_ciphers, resulting in SSL context leak. In theory, ngx_pool_cleanup_add() may fail too, but this case is intentionally left out for now as it's almost impossible and proper fix will require changes to http ssl and mail ssl code as well.
Diffstat (limited to 'src/http/modules/ngx_http_uwsgi_module.c')
-rw-r--r--src/http/modules/ngx_http_uwsgi_module.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c
index 17dfc3b3a..80d6cde40 100644
--- a/src/http/modules/ngx_http_uwsgi_module.c
+++ b/src/http/modules/ngx_http_uwsgi_module.c
@@ -2012,6 +2012,14 @@ ngx_http_uwsgi_set_ssl(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *uwcf)
return NGX_ERROR;
}
+ cln = ngx_pool_cleanup_add(cf->pool, 0);
+ if (cln == NULL) {
+ return NGX_ERROR;
+ }
+
+ cln->handler = ngx_ssl_cleanup_ctx;
+ cln->data = uwcf->upstream.ssl;
+
if (SSL_CTX_set_cipher_list(uwcf->upstream.ssl->ctx,
(const char *) uwcf->ssl_ciphers.data)
== 0)
@@ -2022,14 +2030,6 @@ ngx_http_uwsgi_set_ssl(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *uwcf)
return NGX_ERROR;
}
- cln = ngx_pool_cleanup_add(cf->pool, 0);
- if (cln == NULL) {
- return NGX_ERROR;
- }
-
- cln->handler = ngx_ssl_cleanup_ctx;
- cln->data = uwcf->upstream.ssl;
-
return NGX_OK;
}