]> git.kaiwu.me - nginx.git/commitdiff
fix segfault on close error
authorIgor Sysoev <igor@sysoev.ru>
Tue, 25 Nov 2008 14:45:44 +0000 (14:45 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 25 Nov 2008 14:45:44 +0000 (14:45 +0000)
src/core/ngx_conf_file.c

index d06c4da8e3d53086c1652c185369020528408771..60ba330b8d2282dc9fa7591afdae30ba0ddb4e1f 100644 (file)
@@ -258,14 +258,14 @@ done:
     if (filename) {
         ngx_free(cf->conf_file->buffer->start);
 
-        cf->conf_file = prev;
-
         if (ngx_close_file(fd) == NGX_FILE_ERROR) {
             ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
                           ngx_close_file_n " %s failed",
                           cf->conf_file->file.name.data);
             return NGX_CONF_ERROR;
         }
+
+        cf->conf_file = prev;
     }
 
     if (rc == NGX_ERROR) {