Close file descriptor in query logging (#11148)

Signed-off-by: Cosrider <cosrider7@gmail.com>

Signed-off-by: Cosrider <cosrider7@gmail.com>
This commit is contained in:
Cosrider 2022-08-17 17:57:27 +08:00 committed by GitHub
parent 9594fa4dbd
commit af79dce8ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,6 +64,7 @@ func logUnfinishedQueries(filename string, filesize int, logger log.Logger) {
level.Error(logger).Log("msg", "Failed to open query log file", "err", err) level.Error(logger).Log("msg", "Failed to open query log file", "err", err)
return return
} }
defer fd.Close()
brokenJSON := make([]byte, filesize) brokenJSON := make([]byte, filesize)
_, err = fd.Read(brokenJSON) _, err = fd.Read(brokenJSON)