From 747308fd0130c564cbdb2fc31aaeb5a2508d20a5 Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Mon, 1 Apr 2024 21:30:32 +0800 Subject: [PATCH] cmd/covdata: close output meta-data file Signed-off-by: guoguangwu --- src/cmd/covdata/metamerge.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cmd/covdata/metamerge.go b/src/cmd/covdata/metamerge.go index bf088b11366..70beabc0224 100644 --- a/src/cmd/covdata/metamerge.go +++ b/src/cmd/covdata/metamerge.go @@ -237,6 +237,11 @@ func (mm *metaMerge) emitMeta(outdir string, pcombine bool) [16]byte { if err != nil { fatal("unable to open output meta-data file %s: %v", fpath, err) } + defer func() { + if err := mf.Close(); err != nil { + fatal("error closing output meta-data file %s: %v", fpath, err) + } + }() // Encode and write. mfw := encodemeta.NewCoverageMetaFileWriter(fpath, mf)