From f21880bb2c9510c1aeb3b96b799a18d3b8ad27c6 Mon Sep 17 00:00:00 2001 From: Karsten Knese Date: Wed, 6 Dec 2017 17:26:35 -0800 Subject: [PATCH] do not deallocate state/transition pointer within the fini functions (#200) --- rcl_lifecycle/src/rcl_lifecycle.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rcl_lifecycle/src/rcl_lifecycle.c b/rcl_lifecycle/src/rcl_lifecycle.c index 74eb5c9..6c9e30b 100644 --- a/rcl_lifecycle/src/rcl_lifecycle.c +++ b/rcl_lifecycle/src/rcl_lifecycle.c @@ -89,8 +89,6 @@ rcl_lifecycle_state_fini( allocator->deallocate((char *)state->label, allocator->state); state->label = NULL; } - allocator->deallocate(state, allocator->state); - state = NULL; return RCL_RET_OK; } @@ -159,16 +157,18 @@ rcl_lifecycle_transition_fini( if (rcl_lifecycle_state_fini(transition->start, allocator) != RCL_RET_OK) { ret = RCL_RET_ERROR; } + allocator->deallocate(transition->start, allocator->state); + transition->start = NULL; + if (rcl_lifecycle_state_fini(transition->goal, allocator) != RCL_RET_OK) { ret = RCL_RET_ERROR; } + allocator->deallocate(transition->goal, allocator->state); + transition->goal = NULL; allocator->deallocate((char *)transition->label, allocator->state); transition->label = NULL; - allocator->deallocate(transition, allocator->state); - transition = NULL; - return ret; }