]> Cypherpunks repositories - gostls13.git/commitdiff
net: acquire thread in resSearch
authorMateusz Poliwczak <mpoliwczak34@gmail.com>
Thu, 1 Dec 2022 09:26:18 +0000 (09:26 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 1 Dec 2022 21:00:47 +0000 (21:00 +0000)
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>

src/net/cgo_unix.go

index ef003b78bd5c8b9d5d8c8ed6fa22763a50a01fbc..209724cf1d68537951eacb14695a512bae1fd200 100644 (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
 // 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 {