do not deallocate state/transition pointer within the fini functions (#200)

This commit is contained in:
Karsten Knese 2017-12-06 17:26:35 -08:00 committed by GitHub
parent 5faf966459
commit f21880bb2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,8 +89,6 @@ rcl_lifecycle_state_fini(
allocator->deallocate((char *)state->label, allocator->state); allocator->deallocate((char *)state->label, allocator->state);
state->label = NULL; state->label = NULL;
} }
allocator->deallocate(state, allocator->state);
state = NULL;
return RCL_RET_OK; return RCL_RET_OK;
} }
@ -159,16 +157,18 @@ rcl_lifecycle_transition_fini(
if (rcl_lifecycle_state_fini(transition->start, allocator) != RCL_RET_OK) { if (rcl_lifecycle_state_fini(transition->start, allocator) != RCL_RET_OK) {
ret = RCL_RET_ERROR; ret = RCL_RET_ERROR;
} }
allocator->deallocate(transition->start, allocator->state);
transition->start = NULL;
if (rcl_lifecycle_state_fini(transition->goal, allocator) != RCL_RET_OK) { if (rcl_lifecycle_state_fini(transition->goal, allocator) != RCL_RET_OK) {
ret = RCL_RET_ERROR; ret = RCL_RET_ERROR;
} }
allocator->deallocate(transition->goal, allocator->state);
transition->goal = NULL;
allocator->deallocate((char *)transition->label, allocator->state); allocator->deallocate((char *)transition->label, allocator->state);
transition->label = NULL; transition->label = NULL;
allocator->deallocate(transition, allocator->state);
transition = NULL;
return ret; return ret;
} }