1
0
mirror of https://github.com/golang/go synced 2024-11-18 04:34:52 -07:00

net: acquire thread in resSearch

Change-Id: I042906d8eee8defafbd98f671fd30c2a68281705
GitHub-Last-Rev: 0660c9a989
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>
This commit is contained in:
Mateusz Poliwczak 2022-12-01 09:26:18 +00:00 committed by Gopher Robot
parent 93587d3591
commit cd133abc5b

View File

@ -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 // resSearch will make a call to the 'res_nsearch' routine in the C library
// and parse the output as a slice of DNS resources. // and parse the output as a slice of DNS resources.
func resSearch(ctx context.Context, hostname string, rtype, class int) ([]dnsmessage.Resource, error) { 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{}))) state := (*_C_struct___res_state)(_C_malloc(unsafe.Sizeof(_C_struct___res_state{})))
defer _C_free(unsafe.Pointer(state)) defer _C_free(unsafe.Pointer(state))
if err := _C_res_ninit(state); err != nil { if err := _C_res_ninit(state); err != nil {