runtime/cgo: add acquire/release back around malloc

This was accidentally dropped in CL 746300.

Fixes #67800.
Fixes #78479.

Change-Id: If78ba91fbdc2ab67d48c9200e5c7a9706a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/775920
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Pratt 2026-05-08 11:47:07 -04:00 committed by Gopher Robot
parent 373b3a9097
commit c7d87cda53

View file

@ -185,7 +185,9 @@ x_cgo_thread_start(ThreadStart *arg)
ThreadStart *ts;
/* Make our own copy that can persist after we return. */
_cgo_tsan_acquire();
ts = malloc(sizeof *ts);
_cgo_tsan_release();
if(ts == nil) {
fprintf(stderr, "runtime/cgo: out of memory in thread_start\n");
abort();