1
0
mirror of https://github.com/golang/go synced 2024-11-15 05:20:21 -07:00

cmd/link: close the file opened in the captureHostObj function

Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This commit is contained in:
guoguangwu 2024-04-06 14:24:07 +08:00
parent 58c5db3169
commit e27484cd43

View File

@ -2848,6 +2848,7 @@ func captureHostObj(h *Hostobj) {
if err != nil { if err != nil {
log.Fatalf("capturing host obj: open failed on %s: %v", h.pn, err) log.Fatalf("capturing host obj: open failed on %s: %v", h.pn, err)
} }
defer inf.Close()
res := make([]byte, h.length) res := make([]byte, h.length)
if n, err := inf.ReadAt(res, h.off); err != nil || n != int(h.length) { if n, err := inf.ReadAt(res, h.off); err != nil || n != int(h.length) {
log.Fatalf("capturing host obj: readat failed on %s: %v", h.pn, err) log.Fatalf("capturing host obj: readat failed on %s: %v", h.pn, err)