From a8766adb55a5aec97c9585787b968ba2bc4e15a3 Mon Sep 17 00:00:00 2001 From: Scott Miller Date: Mon, 2 Apr 2018 09:30:45 -0400 Subject: [PATCH] ompi/oshmem: fix shmem_free to perform no-op on null ptr Signed-off-by: Scott Miller --- oshmem/shmem/c/shmem_free.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/oshmem/shmem/c/shmem_free.c b/oshmem/shmem/c/shmem_free.c index 71801a297e..b0e706b009 100644 --- a/oshmem/shmem/c/shmem_free.c +++ b/oshmem/shmem/c/shmem_free.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2013-2015 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,7 +42,12 @@ static inline void _shfree(void* ptr) { int rc; - RUNTIME_CHECK_INIT(); RUNTIME_CHECK_ADDR(ptr); + RUNTIME_CHECK_INIT(); + if (NULL == ptr) { + return; + } + + RUNTIME_CHECK_ADDR(ptr); #if OSHMEM_SPEC_COMPAT == 1 shmem_barrier_all();