mirror of
https://github.com/nginx/nginx.git
synced 2024-12-19 05:33:52 -06:00
SSL: separate checks for errors in ngx_ssl_read_password_file().
Checking multiple errors at once is a bad practice, as in general it is not guaranteed that an object can be used after the error. In this particular case, checking errors after multiple allocations can result in excessive errors being logged when there is no memory available.
This commit is contained in:
parent
80f105b054
commit
f7d53c4ae4
@ -947,10 +947,13 @@ ngx_ssl_read_password_file(ngx_conf_t *cf, ngx_str_t *file)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cln = ngx_pool_cleanup_add(cf->temp_pool, 0);
|
||||
passwords = ngx_array_create(cf->temp_pool, 4, sizeof(ngx_str_t));
|
||||
if (passwords == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cln == NULL || passwords == NULL) {
|
||||
cln = ngx_pool_cleanup_add(cf->temp_pool, 0);
|
||||
if (cln == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user