Commit 9a7a22b5 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3963] Fix memmory leak when parsing instant message xml

parent c116e789
......@@ -25,7 +25,7 @@ static void XMLCALL startElementCallback (void *userData, const char *name, cons
if (strcmp (name, "entry") == 0) {
sfl::InstantMessaging::UriList *list = static_cast<sfl::InstantMessaging::UriList *> (userData);
sfl::InstantMessaging::UriEntry *entry = new sfl::InstantMessaging::UriEntry();
sfl::InstantMessaging::UriEntry entry = sfl::InstantMessaging::UriEntry();
for (att = atts; *att; att += 2) {
......@@ -36,7 +36,7 @@ static void XMLCALL startElementCallback (void *userData, const char *name, cons
// _debug ("InstantMessaging: attribute: %s, value: %s", attribute, value);
entry->insert (std::pair<std::string, std::string> (std::string (attribute), std::string (value)));
entry.insert (std::pair<std::string, std::string> (std::string (attribute), std::string (value)));
}
list->push_back (entry);
......@@ -246,6 +246,8 @@ bool InstantMessaging::send_iax_message (iax_session* session, const CallID& id,
// TODO: Send every messages
ret = iax_send (session, id, multiple_messages[i]);
}
return ret;
}
......@@ -291,8 +293,8 @@ std::string InstantMessaging::generateXmlUriList (UriList& list)
while (iterEntry != list.end()) {
xmlbuffer.append ("<entry uri=");
UriEntry *entry = static_cast<UriEntry *> (*iterEntry);
iterAttr = entry->find (sfl::IM_XML_URI);
UriEntry entry = static_cast<UriEntry> (*iterEntry);
iterAttr = entry.find (sfl::IM_XML_URI);
xmlbuffer.append (iterAttr->second);
xmlbuffer.append (" cp:copyControl=\"to\" />");
......
......@@ -57,7 +57,7 @@ class InstantMessaging
public:
typedef std::map <std::string, std::string> UriEntry;
typedef std::list <UriEntry *> UriList;
typedef std::list <UriEntry> UriList;
/*
* Class constructor
......
......@@ -1077,7 +1077,7 @@ SIPVoIPLink::sendTextMessage (sfl::InstantMessaging *module, const std::string&
sfl::InstantMessaging::UriEntry entry;
entry[sfl::IM_XML_URI] = std::string (formatedFrom);
list.push_front (&entry);
list.push_front (entry);
std::string formatedMessage = module->appendUriList (message, list);
......@@ -3506,8 +3506,8 @@ void call_on_tsx_changed (pjsip_inv_session *inv UNUSED, pjsip_transaction *tsx,
if (list.empty()) {
from = call->getPeerNumber ();
} else {
sfl::InstantMessaging::UriEntry *entry = list.front();
sfl::InstantMessaging::UriEntry::iterator iterAttr = entry->find (IM_XML_URI);
sfl::InstantMessaging::UriEntry entry = list.front();
sfl::InstantMessaging::UriEntry::iterator iterAttr = entry.find (IM_XML_URI);
if (iterAttr->second != "Me")
from = iterAttr->second;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment