From 5d5d1f946d93a9b99469fa10af585f3e678066e5 Mon Sep 17 00:00:00 2001 From: vivek-shankar Date: Sun, 29 Jan 2017 14:00:52 -0500 Subject: [PATCH] wrong parameter bug correction --- src/CommunicationManager.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/CommunicationManager.cpp b/src/CommunicationManager.cpp index 6201c53..f7693b0 100644 --- a/src/CommunicationManager.cpp +++ b/src/CommunicationManager.cpp @@ -644,7 +644,7 @@ inline void CommunicationManager::Send_Mavlink_Message_Callback( uint16_t* header_16 = u64_cvt_u16(header); /*buffer byte counter*/ int tot=0; - //std::cout << "Sent header" <payload64.size() <= MAX_NBR_OF_INT64){ @@ -686,18 +686,20 @@ inline void CommunicationManager::Send_Mavlink_Message_Callback( /*Copy the msgs into a 64bit array*/ uint64_t message_obt[mavlink_msg->payload64.size()]; /*buffer for easy handel operation*/ - uint8_t* cpy_buff = (uint8_t*)malloc( sizeof(uint64_t)+sizeof(uint16_t) + ( sizeof(uint64_t)*mavlink_msg->payload64.size() ) ); - memset(cpy_buff, 0,sizeof(uint64_t) + ( sizeof(uint64_t)*mavlink_msg->payload64.size() )); + uint8_t* cpy_buff = (uint8_t*)malloc( sizeof(uint64_t)+sizeof(uint16_t) + ( sizeof(uint64_t)*MAX_NBR_OF_INT64 ) ); + memset(cpy_buff, 0,sizeof(uint64_t) + ( sizeof(uint64_t)*MAX_NBR_OF_INT64 )); for (std::size_t i =0; ipayload64.size(); i++) { message_obt[i] =(uint64_t)mavlink_msg->payload64[i]; } + //std::cout << "put header in dict" <