From 510a9e4aff6e57a3d2c7cae41957d1678b5b5858 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Wed, 31 Oct 2018 02:23:19 -0700 Subject: [PATCH] Adding Null check node_secure_root --- rcl/src/rcl/node.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rcl/src/rcl/node.c b/rcl/src/rcl/node.c index 19b681136..39e30d443 100644 --- a/rcl/src/rcl/node.c +++ b/rcl/src/rcl/node.c @@ -147,7 +147,11 @@ const char * rcl_get_secure_root( allocator->deallocate(node_fqn, allocator->state); allocator->deallocate(node_root_path, allocator->state); } - if (!rcutils_is_directory(node_secure_root)) { + // Check node_secure_root is not NULL before checking directory + if (NULL == node_secure_root) { + allocator->deallocate(node_secure_root, allocator->state); + return NULL; + } else if (!rcutils_is_directory(node_secure_root)) { allocator->deallocate(node_secure_root, allocator->state); return NULL; }