Skip to content

Commit ba14755

Browse files
authored
Merge pull request #10331 from MamziB/mamzi/oshmem-calloc
oshmem: making shmem_calloc spec-compliant regarding zero-byte inputs
2 parents c52ab16 + 09a9577 commit ba14755

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

oshmem/shmem/c/shmem_alloc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ void* shmem_malloc(size_t size)
3939
void* shmem_calloc(size_t count, size_t size)
4040
{
4141
size_t req_sz = count * size;
42+
if (!req_sz) return NULL;
4243
void *ptr = _shmalloc(req_sz);
4344
if (ptr) {
4445
memset(ptr, 0, req_sz);

0 commit comments

Comments
 (0)