From 43043bc5e6eef4be712e249626b6569ff88e1b5b Mon Sep 17 00:00:00 2001 From: guoguangwu <guoguangwug@gmail.com> Date: Fri, 26 Apr 2024 18:08:15 +0800 Subject: [PATCH] fix: close file Signed-off-by: guoguangwu <guoguangwug@gmail.com> --- service/process/executable.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/process/executable.go b/service/process/executable.go index a6f4fdce..107d91da 100644 --- a/service/process/executable.go +++ b/service/process/executable.go @@ -30,6 +30,10 @@ func (p *Process) GetExecHash(algorithm string) (string, error) { return "", err } + defer func() { + _ = file.Close() + }() + _, err = io.Copy(hasher, file) if err != nil { return "", err