From e45c6dce2ca1eede03a42c6f9e09639bcf0b635b Mon Sep 17 00:00:00 2001 From: guangwu Date: Wed, 15 May 2024 17:00:29 +0800 Subject: [PATCH] fix: close procRoot dir --- internal/component/pyroscope/java/asprof/asprof.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/component/pyroscope/java/asprof/asprof.go b/internal/component/pyroscope/java/asprof/asprof.go index 9090792aa901..0e408e55d4a9 100644 --- a/internal/component/pyroscope/java/asprof/asprof.go +++ b/internal/component/pyroscope/java/asprof/asprof.go @@ -115,6 +115,7 @@ func (p *Profiler) CopyLib(dist *Distribution, pid int) error { if err != nil { return fmt.Errorf("failed to open proc root %s: %w", procRoot, err) } + defer procRootFile.Close() dstLibPath := strings.TrimPrefix(dist.LibPath(), "/") dstLauncherPath := strings.TrimPrefix(dist.LauncherPath(), "/") if err = writeFile(procRootFile, dstLibPath, libData, false); err != nil {