Use defer to close binary hash subject

This commit is contained in:
2026-02-10 00:36:32 -05:00
parent c5e259a446
commit 1745b85662
+1 -1
View File
@@ -37,8 +37,8 @@ func (h *RCWService) EncryptRequestAndZeroizeDecBytes(decBytes []byte, reply *[]
// getFileHash returns the SHA256 hash of the file at the given path.
func getFileHash(path string) []byte {
file, _ := os.Open(path)
defer file.Close()
hash := sha256.New()
io.Copy(hash, file)
file.Close()
return hash.Sum(nil)
}