1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:10:07 -07:00

cmd/cgo: avoid leaking fds

Fixes #5714.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/10386043
This commit is contained in:
Dave Cheney 2013-06-18 23:20:17 +10:00
parent 7468b1d36a
commit f9c22f7e78

View File

@ -716,6 +716,7 @@ func (p *Package) gccDebug(stdin []byte) (*dwarf.Data, binary.ByteOrder, []byte)
runGcc(stdin, p.gccCmd())
if f, err := macho.Open(gccTmp()); err == nil {
defer f.Close()
d, err := f.DWARF()
if err != nil {
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)
@ -742,6 +743,7 @@ func (p *Package) gccDebug(stdin []byte) (*dwarf.Data, binary.ByteOrder, []byte)
}
if f, err := elf.Open(gccTmp()); err == nil {
defer f.Close()
d, err := f.DWARF()
if err != nil {
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)
@ -768,6 +770,7 @@ func (p *Package) gccDebug(stdin []byte) (*dwarf.Data, binary.ByteOrder, []byte)
}
if f, err := pe.Open(gccTmp()); err == nil {
defer f.Close()
d, err := f.DWARF()
if err != nil {
fatalf("cannot load DWARF output from %s: %v", gccTmp(), err)