From 2cccf6760120a2a47d14a7203c4323def50ed8d9 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Tue, 6 Oct 2020 19:27:58 -0400 Subject: [PATCH] Avoid leaving a file open for longer than necessary --- cmd/certspotter/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/certspotter/main.go b/cmd/certspotter/main.go index 00e62ca..c564ff7 100644 --- a/cmd/certspotter/main.go +++ b/cmd/certspotter/main.go @@ -221,8 +221,8 @@ func main() { fmt.Fprintf(os.Stderr, "%s: %s: %s\n", os.Args[0], *watchlistFilename, err) os.Exit(1) } - defer file.Close() watchlist, err = readWatchlist(file) + file.Close() if err != nil { fmt.Fprintf(os.Stderr, "%s: %s: %s\n", os.Args[0], *watchlistFilename, err) os.Exit(1)