transition coverity fix
Advancing a transition might free it, so we cannot always guarantee it will be valid after the call. The only way to make sure the transition is still valid is using a weak reference before advancing it, and then check if the weak reference still holds the transition after it was advanced.
This MR fixes the transition unit test coverity issues by using a weak reference, and then, uses that weak reference to get the transition before checking if it was completed or not, avoiding "Use after free" errors.
The same logic is applied in
module-reserve-device to make sure the transition is always valid.