vtol_att_control: initialise pointers and free memory

Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
Roman 2016-11-21 20:43:58 +01:00 committed by Julian Oes
parent 7a698952fb
commit 92a5db92a2
2 changed files with 9 additions and 4 deletions

View File

@ -177,6 +177,11 @@ VtolAttitudeControl::~VtolAttitudeControl()
} while (_control_task != -1);
}
// free memory used by instances of base class VtolType
if (_vtol_type != nullptr) {
delete _vtol_type;
}
VTOL_att_control::g_control = nullptr;
}

View File

@ -218,10 +218,10 @@ private:
int _transition_command;
bool _abort_front_transition;
VtolType *_vtol_type; // base class for different vtol types
Tiltrotor *_tiltrotor; // tailsitter vtol type
Tailsitter *_tailsitter; // tiltrotor vtol type
Standard *_standard; // standard vtol type
VtolType *_vtol_type = nullptr; // base class for different vtol types
Tiltrotor *_tiltrotor = nullptr; // tailsitter vtol type
Tailsitter *_tailsitter = nullptr; // tiltrotor vtol type
Standard *_standard = nullptr; // standard vtol type
//*****************Member functions***********************************************************************