Mercurial > hg > nginx
comparison src/core/ngx_conf_file.c @ 5681:56ad171c3dd1
Core: improved ngx_conf_parse() error handling.
Previous code failed to properly restore cf->conf_file in case of
ngx_close_file() errors, potentially resulting in double free of
cf->conf_file->buffer->start.
Found by Coverity (CID 1087507).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 30 Apr 2014 19:16:49 +0400 |
parents | e04083b79335 |
children | f87afb46ccd2 |
comparison
equal
deleted
inserted
replaced
5680:dfb3c15bc851 | 5681:56ad171c3dd1 |
---|---|
264 | 264 |
265 if (ngx_close_file(fd) == NGX_FILE_ERROR) { | 265 if (ngx_close_file(fd) == NGX_FILE_ERROR) { |
266 ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno, | 266 ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno, |
267 ngx_close_file_n " %s failed", | 267 ngx_close_file_n " %s failed", |
268 filename->data); | 268 filename->data); |
269 return NGX_CONF_ERROR; | 269 rc = NGX_ERROR; |
270 } | 270 } |
271 | 271 |
272 cf->conf_file = prev; | 272 cf->conf_file = prev; |
273 } | 273 } |
274 | 274 |