diff options
author | Mateusz Poliwczak <mpoliwczak34@gmail.com> | 2022-12-01 09:26:18 +0000 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2022-12-01 21:00:47 +0000 |
commit | cd133abc5b5cd37f4ac796d86f9e9dbb913903d8 (patch) | |
tree | d9bcfe85bdf39bede180782475b0b2519e4e5e6f | |
parent | 93587d3591f6cb5cd21951a03c3aa750873f2601 (diff) | |
download | go-cd133abc5b5cd37f4ac796d86f9e9dbb913903d8.tar.gz go-cd133abc5b5cd37f4ac796d86f9e9dbb913903d8.zip |
net: acquire thread in resSearch
Change-Id: I042906d8eee8defafbd98f671fd30c2a68281705
GitHub-Last-Rev: 0660c9a989600eeb8652d1228777488d28397731
GitHub-Pull-Request: golang/go#57021
Reviewed-on: https://go-review.googlesource.com/c/go/+/454396
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
-rw-r--r-- | src/net/cgo_unix.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/net/cgo_unix.go b/src/net/cgo_unix.go index ef003b78bd..209724cf1d 100644 --- a/src/net/cgo_unix.go +++ b/src/net/cgo_unix.go @@ -331,6 +331,9 @@ func cgoLookupCNAME(ctx context.Context, name string) (cname string, err error, // resSearch will make a call to the 'res_nsearch' routine in the C library // and parse the output as a slice of DNS resources. func resSearch(ctx context.Context, hostname string, rtype, class int) ([]dnsmessage.Resource, error) { + acquireThread() + defer releaseThread() + state := (*_C_struct___res_state)(_C_malloc(unsafe.Sizeof(_C_struct___res_state{}))) defer _C_free(unsafe.Pointer(state)) if err := _C_res_ninit(state); err != nil { |