comparison src/http/modules/ngx_http_uwsgi_module.c @ 7473:8981dbb12254

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 03 Mar 2019 16:48:39 +0300
parents 8b68d50090e4
children 8cf31489b479
comparison
equal deleted inserted replaced
7472:d430babbe643 7473:8981dbb12254
2357 return NGX_ERROR; 2357 return NGX_ERROR;
2358 } 2358 }
2359 2359
2360 cln = ngx_pool_cleanup_add(cf->pool, 0); 2360 cln = ngx_pool_cleanup_add(cf->pool, 0);
2361 if (cln == NULL) { 2361 if (cln == NULL) {
2362 ngx_ssl_cleanup_ctx(uwcf->upstream.ssl);
2362 return NGX_ERROR; 2363 return NGX_ERROR;
2363 } 2364 }
2364 2365
2365 cln->handler = ngx_ssl_cleanup_ctx; 2366 cln->handler = ngx_ssl_cleanup_ctx;
2366 cln->data = uwcf->upstream.ssl; 2367 cln->data = uwcf->upstream.ssl;