From 1745b856627fa312943da8292939dfcba1d373f8 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Tue, 10 Feb 2026 00:36:32 -0500 Subject: [PATCH] Use defer to close binary hash subject --- daemon/2server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/2server.go b/daemon/2server.go index 9883bb6..341da25 100644 --- a/daemon/2server.go +++ b/daemon/2server.go @@ -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) }