Skip to content

Commit 09a9577

Browse files
Mamzi Bayatpour  mbayatpour@nvidia.com ()janjust
andcommitted
oshmem: making shmem_calloc spec compliant regarding zero-byte inputs
Signed-off-by: Mamzi Bayatpour <mbayatpour@nvidia.com> Co-authored-by: Tomislav Janjusic <tomislavj@nvidia.com>
1 parent f0f94fb commit 09a9577

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)