diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 681ab7f4c8172f3b3253484cccdcf56d5a42756d..41a87832717384c20747f62f5693f4daa60655f8 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -3446,6 +3446,7 @@ void Vehicle::requestMessage(RequestMessageResultHandler resultHandler, void* re { RequestMessageInfo_t* pInfo = new RequestMessageInfo_t; + *pInfo = { }; pInfo->msgId = messageId; pInfo->compId = compId; pInfo->resultHandler = resultHandler; diff --git a/src/Vehicle/Vehicle.h b/src/Vehicle/Vehicle.h index 407a2650bbd38a6fe6028f012db5fe64f18466fc..f45a86b755c85169bd2ac58b38850eaab0151d03 100644 --- a/src/Vehicle/Vehicle.h +++ b/src/Vehicle/Vehicle.h @@ -1581,12 +1581,12 @@ private: // requestMessage handling typedef struct { - bool commandAckReceived = false; // We keep track of the ack/message being received since the order in which this will come in is random - bool messageReceived = false; // We only delete the allocated RequestMessageInfo_t when both happen (or the message wait times out) - int msgId = 0; - int compId = 0; - RequestMessageResultHandler resultHandler = nullptr; - void* resultHandlerData = nullptr; + bool commandAckReceived; // We keep track of the ack/message being received since the order in which this will come in is random + bool messageReceived; // We only delete the allocated RequestMessageInfo_t when both happen (or the message wait times out) + int msgId; + int compId; + RequestMessageResultHandler resultHandler; + void* resultHandlerData; } RequestMessageInfo_t; static void _requestMessageCmdResultHandler (void* resultHandlerData, int compId, MAV_RESULT result, bool noResponsefromVehicle);