mirror of
https://github.com/rwinkhart/rcw.git
synced 2026-10-26 22:09:56 -04:00
Use defer to close binary hash subject
This commit is contained in:
1 parent
c5e259a446
commit
1745b85662
1 file changed
+1
-1
+1
-1
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user