mirror of
https://github.com/rwinkhart/rcw.git
synced 2026-08-27 20:36:30 -04:00
Use defer to close binary hash subject
This commit is contained in:
+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.
|
// getFileHash returns the SHA256 hash of the file at the given path.
|
||||||
func getFileHash(path string) []byte {
|
func getFileHash(path string) []byte {
|
||||||
file, _ := os.Open(path)
|
file, _ := os.Open(path)
|
||||||
|
defer file.Close()
|
||||||
hash := sha256.New()
|
hash := sha256.New()
|
||||||
io.Copy(hash, file)
|
io.Copy(hash, file)
|
||||||
file.Close()
|
|
||||||
return hash.Sum(nil)
|
return hash.Sum(nil)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user