]> git.kaiwu.me - nginx.git/commitdiff
Core: improved ngx_conf_parse() error handling.
authorMaxim Dounin <mdounin@mdounin.ru>
Wed, 30 Apr 2014 15:16:49 +0000 (19:16 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Wed, 30 Apr 2014 15:16:49 +0000 (19:16 +0400)
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).

src/core/ngx_conf_file.c

index f61bfcabf99fa88f28a020b5f633cf9c451ad57f..d6b5cdf1e2b82f4ec0edde3991f67404f209829d 100644 (file)
@@ -266,7 +266,7 @@ done:
             ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
                           ngx_close_file_n " %s failed",
                           filename->data);
-            return NGX_CONF_ERROR;
+            rc = NGX_ERROR;
         }
 
         cf->conf_file = prev;