From db4712f455def37b5e6eca1a15dbe808531e0a10 Mon Sep 17 00:00:00 2001 From: Christian Simon Date: Thu, 22 Aug 2024 17:00:44 +0100 Subject: [PATCH] fix: close procRoot dir (#891) Co-authored-by: guangwu --- 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 451e6ffded..e6052153c4 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 {