fix for potential duplicate free
This commit is contained in:
@@ -165,7 +165,7 @@ MainLoop::MainLoop(const struct options& opt, Device *device, MessageMap* messag
|
|||||||
} else {
|
} else {
|
||||||
logError(lf_main, "error registering data handlers");
|
logError(lf_main, "error registering data handlers");
|
||||||
}
|
}
|
||||||
m_newlyDefinedMessages = opt.enableDefine ? new MessageMap(true) : NULL;
|
m_newlyDefinedMessages = opt.enableDefine ? new MessageMap(true, "", false) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainLoop::~MainLoop() {
|
MainLoop::~MainLoop() {
|
||||||
|
|||||||
@@ -474,8 +474,8 @@ result_t Message::create(const string& filename, const DataFieldTemplates* templ
|
|||||||
return RESULT_OK;
|
return RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Message* Message::createScanMessage(bool broadcast) {
|
Message* Message::createScanMessage(bool broadcast, bool deleteData) {
|
||||||
return new Message("scan", "", "", 0x07, 0x04, broadcast, DataFieldSet::getIdentFields(), !broadcast);
|
return new Message("scan", "", "", 0x07, 0x04, broadcast, DataFieldSet::getIdentFields(), deleteData);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Message::extractFieldNames(const string& str, bool checkAbbreviated, vector<string>* fields) {
|
bool Message::extractFieldNames(const string& str, bool checkAbbreviated, vector<string>* fields) {
|
||||||
|
|||||||
@@ -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.
|
* @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.
|
* @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.
|
* 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 addAll whether to add all messages, even if duplicate.
|
||||||
* @param preferLanguage the preferred language to use, or empty.
|
* @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),
|
: MappedFileReader::MappedFileReader(true),
|
||||||
m_addAll(addAll), m_additionalScanMessages(false), m_maxIdLength(0), m_maxBroadcastIdLength(0),
|
m_addAll(addAll), m_additionalScanMessages(false), m_maxIdLength(0), m_maxBroadcastIdLength(0),
|
||||||
m_messageCount(0), m_conditionalMessageCount(0), m_passiveMessageCount(0) {
|
m_messageCount(0), m_conditionalMessageCount(0), m_passiveMessageCount(0) {
|
||||||
m_scanMessage = Message::createScanMessage();
|
m_scanMessage = Message::createScanMessage(false, deleteData);
|
||||||
m_broadcastScanMessage = Message::createScanMessage(true);
|
m_broadcastScanMessage = Message::createScanMessage(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user