Skip to content

Commit 926d267

Browse files
authored
Merge pull request #5122 from sam6258/shmem_free_fix_v3.0.x
v3.0.x: ompi/oshmem: fix shmem_free to perform no-op on null ptr
2 parents 7bbe78d + f900fd6 commit 926d267

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

oshmem/shmem/c/shmem_free.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Copyright (c) 2013-2015 Mellanox Technologies, Inc.
33
* All rights reserved.
4+
* Copyright (c) 2018 IBM Corporation. All rights reserved.
45
* $COPYRIGHT$
56
*
67
* Additional copyrights may follow
@@ -41,7 +42,12 @@ static inline void _shfree(void* ptr)
4142
{
4243
int rc;
4344

44-
RUNTIME_CHECK_INIT(); RUNTIME_CHECK_ADDR(ptr);
45+
RUNTIME_CHECK_INIT();
46+
if (NULL == ptr) {
47+
return;
48+
}
49+
50+
RUNTIME_CHECK_ADDR(ptr);
4551

4652
#if OSHMEM_SPEC_COMPAT == 1
4753
shmem_barrier_all();

0 commit comments

Comments
 (0)