comparison src/stream/ngx_stream_ssl_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 7e8bcba6d039
children ef7ee19776db
comparison
equal deleted inserted replaced
7472:d430babbe643 7473:8981dbb12254
688 return NGX_CONF_ERROR; 688 return NGX_CONF_ERROR;
689 } 689 }
690 690
691 cln = ngx_pool_cleanup_add(cf->pool, 0); 691 cln = ngx_pool_cleanup_add(cf->pool, 0);
692 if (cln == NULL) { 692 if (cln == NULL) {
693 ngx_ssl_cleanup_ctx(&conf->ssl);
693 return NGX_CONF_ERROR; 694 return NGX_CONF_ERROR;
694 } 695 }
695 696
696 cln->handler = ngx_ssl_cleanup_ctx; 697 cln->handler = ngx_ssl_cleanup_ctx;
697 cln->data = &conf->ssl; 698 cln->data = &conf->ssl;