fix for potential duplicate free

This commit is contained in:
john30
2018-04-08 19:07:49 +02:00
parent 00dce10324
commit 10e0c96ac2
3 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -197,7 +197,7 @@ class Message : public AttributedItem {
* @param broadcast true for broadcast scan message, false for scan message to be sent to a slave address.
* @return the new scan @a Message instance.
*/
static Message* createScanMessage(bool broadcast = false);
static Message* createScanMessage(bool broadcast = false, bool deleteData = true);
/**
* Extract the known field names from the input string.
@@ -1218,12 +1218,12 @@ class MessageMap : public MappedFileReader {
* @param addAll whether to add all messages, even if duplicate.
* @param preferLanguage the preferred language to use, or empty.
*/
explicit MessageMap(bool addAll = false, const string& preferLanguage = "")
explicit MessageMap(bool addAll = false, const string& preferLanguage = "", bool deleteData = true)
: MappedFileReader::MappedFileReader(true),
m_addAll(addAll), m_additionalScanMessages(false), m_maxIdLength(0), m_maxBroadcastIdLength(0),
m_messageCount(0), m_conditionalMessageCount(0), m_passiveMessageCount(0) {
m_scanMessage = Message::createScanMessage();
m_broadcastScanMessage = Message::createScanMessage(true);
m_scanMessage = Message::createScanMessage(false, deleteData);
m_broadcastScanMessage = Message::createScanMessage(true, false);
}
/**