diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2019-03-03 16:48:39 +0300 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2019-03-03 16:48:39 +0300 |
commit | fe43346dc3151e80dae0acd751f0a94314dcb91c (patch) | |
tree | 8da39450985963593478b57609232c43a4be4159 /src/stream | |
parent | 99d7bb690924e60e9e03096ac5e507111f7c182d (diff) | |
download | nginx-fe43346dc3151e80dae0acd751f0a94314dcb91c.tar.gz nginx-fe43346dc3151e80dae0acd751f0a94314dcb91c.zip |
SSL: fixed potential leak on memory allocation errors.
If ngx_pool_cleanup_add() fails, we have to clean just created SSL context
manually, thus appropriate call added.
Additionally, ngx_pool_cleanup_add() moved closer to ngx_ssl_create() in
the ngx_http_ssl_module, to make sure there are no leaks due to intermediate
code.
Diffstat (limited to 'src/stream')
-rw-r--r-- | src/stream/ngx_stream_proxy_module.c | 1 | ||||
-rw-r--r-- | src/stream/ngx_stream_ssl_module.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c index d7bdec270..127c8a4a4 100644 --- a/src/stream/ngx_stream_proxy_module.c +++ b/src/stream/ngx_stream_proxy_module.c @@ -2096,6 +2096,7 @@ ngx_stream_proxy_set_ssl(ngx_conf_t *cf, ngx_stream_proxy_srv_conf_t *pscf) cln = ngx_pool_cleanup_add(cf->pool, 0); if (cln == NULL) { + ngx_ssl_cleanup_ctx(pscf->ssl); return NGX_ERROR; } diff --git a/src/stream/ngx_stream_ssl_module.c b/src/stream/ngx_stream_ssl_module.c index b099a805a..ec9524e07 100644 --- a/src/stream/ngx_stream_ssl_module.c +++ b/src/stream/ngx_stream_ssl_module.c @@ -690,6 +690,7 @@ ngx_stream_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child) cln = ngx_pool_cleanup_add(cf->pool, 0); if (cln == NULL) { + ngx_ssl_cleanup_ctx(&conf->ssl); return NGX_CONF_ERROR; } |