fix potential segfaults due to use after malloc fails (#2137)

* fix potential segfaults

* replace NULL with nullptr

---------

Co-authored-by: Prasannakumar Murugesan <prmuruge@amd.com>

[ROCm/rccl commit: 4a32ec2501]
This commit is contained in:
prasanna-amd
2026-01-20 14:11:29 -08:00
committed by GitHub
parent bb47eee7cc
commit 520f309bb1
13 changed files with 93 additions and 1 deletions
@@ -115,6 +115,7 @@ __hidden ncclResult_t exampleProfilerInit(void** context, uint64_t commId, int*
// pre-allocate memory for event object pools in dedicated profiler context
struct context* ctx = (struct context *)calloc(1, sizeof(*ctx));
if (ctx == nullptr) return ncclSystemError;
ctx->commName = commName;
ctx->commHash = commId;
ctx->nranks = nranks;