From 274fde9a36bf62f62f9ffda4b178df437649e8bf Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 16 Jul 2018 16:17:27 -0700 Subject: [PATCH] cmd/internal/buildid: close ELF file after reading note Updates #26400 Change-Id: I1747d1f1018521cdfa4b3ed13412a944829967cf Reviewed-on: https://go-review.googlesource.com/124235 Run-TryBot: Ian Lance Taylor Reviewed-by: Brad Fitzpatrick --- src/cmd/internal/buildid/note.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cmd/internal/buildid/note.go b/src/cmd/internal/buildid/note.go index 5895da906a..2d26ea9961 100644 --- a/src/cmd/internal/buildid/note.go +++ b/src/cmd/internal/buildid/note.go @@ -30,6 +30,7 @@ func ReadELFNote(filename, name string, typ int32) ([]byte, error) { if err != nil { return nil, err } + defer f.Close() for _, sect := range f.Sections { if sect.Type != elf.SHT_NOTE { continue