mirror of
https://github.com/golang/go.git
synced 2026-02-07 02:09:55 +00:00
cmd/cgo: compare malloc return value to NULL instead of literal 0
Follow the pattern used in the other _cgoPREFIX_Cfunc* functions. This also avoids a -Wzero-as-null-pointer-constant warning when compiling with g++. Change-Id: I95ac8842df048105f4c738f3603136d9cfa2dfdc Reviewed-on: https://go-review.googlesource.com/c/go/+/664916 Auto-Submit: Keith Randall <khr@golang.org> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
cae45167b7
commit
8587ba272e
1 changed files with 1 additions and 1 deletions
|
|
@ -1812,7 +1812,7 @@ void _cgoPREFIX_Cfunc__Cmalloc(void *v) {
|
|||
void *ret;
|
||||
_cgo_tsan_acquire();
|
||||
ret = malloc(a->p0);
|
||||
if (ret == 0 && a->p0 == 0) {
|
||||
if (ret == NULL && a->p0 == 0) {
|
||||
ret = malloc(1);
|
||||
}
|
||||
a->r1 = ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue