Commit 0bbb6665 authored by Hiroshi Ioka's avatar Hiroshi Ioka Committed by Dave Cheney

cmd/go: fix file leak in TestBuildmodePIE

Change-Id: Ifeb93f6dc75fb5f90d595211fb0f97a89bf74526
Reviewed-on: https://go-review.googlesource.com/64530Reviewed-by: default avatarDave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent c40579ac
...@@ -4474,6 +4474,7 @@ func TestBuildmodePIE(t *testing.T) { ...@@ -4474,6 +4474,7 @@ func TestBuildmodePIE(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer f.Close()
if f.Type != elf.ET_DYN { if f.Type != elf.ET_DYN {
t.Errorf("PIE type must be ET_DYN, but %s", f.Type) t.Errorf("PIE type must be ET_DYN, but %s", f.Type)
} }
...@@ -4482,6 +4483,7 @@ func TestBuildmodePIE(t *testing.T) { ...@@ -4482,6 +4483,7 @@ func TestBuildmodePIE(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer f.Close()
if f.Flags&macho.FlagDyldLink == 0 { if f.Flags&macho.FlagDyldLink == 0 {
t.Error("PIE must have DyldLink flag, but not") t.Error("PIE must have DyldLink flag, but not")
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment