1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

fix memory leak in main messages

This commit is contained in:
andreas
2021-10-30 13:49:20 +02:00
parent 9b65ce51d4
commit 11c6c78ad6
3 changed files with 16 additions and 10 deletions

View File

@@ -245,9 +245,7 @@ bool SetAISClassBMessage24(tNMEA0183AISMsg &NMEA0183AISMsg, uint8_t MessageID,
uint8_t i;
for ( i = 0; i < vships.size(); i++) {
if ( vships[i]->_userID == UserID ) {
Serial.print("UserID gefunden: "); Serial.print(UserID);
ShipName = const_cast<char*>( vships[i]->_shipName.c_str() );
Serial.print(" / "); Serial.println( ShipName);
}
}
if ( i > MAX_SHIP_IN_VECTOR ) {

View File

@@ -29,6 +29,8 @@ class Message{
}
virtual ~Message(){
GW_MESSAGE_DEBUG("~Message %p\n",this);
vSemaphoreDelete(locker);
vSemaphoreDelete(notifier);
}
void unref(){
GW_MESSAGE_DEBUG("Message::unref %p\n",this);
@@ -81,9 +83,9 @@ class RequestMessage : public Message{
protected:
virtual void processRequest()=0;
virtual void processImpl(){
GW_MESSAGE_DEBUG("RequestMessage processImpl(1)");
GW_MESSAGE_DEBUG("RequestMessage processImpl(1) %p\n",this);
processRequest();
GW_MESSAGE_DEBUG("RequestMessage processImpl(2)");
GW_MESSAGE_DEBUG("RequestMessage processImpl(2) %p\n",this);
len=strlen(result.c_str());
consumed=0;
handled=true;
@@ -92,6 +94,7 @@ class RequestMessage : public Message{
RequestMessage():Message(){
}
virtual ~RequestMessage(){
GW_MESSAGE_DEBUG("~RequestMessage %p\n",this)
}
String getResult(){return result;}
int getLen(){return len;}