Skip to content

Commit eaaaa89

Browse files
committed
move f.close to success branch
1 parent a24726c commit eaaaa89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

parse.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ func (p *parser) parse(parsing *Config, tokens <-chan NgxToken, ctx blockCtx, co
385385
// if the file pattern was explicit, nginx will check
386386
// that the included file can be opened and read
387387
if f, err := p.openFile(pattern); err != nil {
388-
defer f.Close()
389388
perr := &ParseError{
390389
What: err.Error(),
391390
File: &parsing.File,
@@ -399,6 +398,7 @@ func (p *parser) parse(parsing *Config, tokens <-chan NgxToken, ctx blockCtx, co
399398
return nil, perr
400399
}
401400
} else {
401+
defer f.Close()
402402
fnames = []string{pattern}
403403
}
404404
}

0 commit comments

Comments
 (0)