From cf656c6ad5c30e225b3c5746c4e0b39f4da587f1 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 e75a8a3ed502..e0cd1d5c4038 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 {