summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2016-11-21 23:40:09 (GMT)
committerPali Rohár <pali.rohar@gmail.com>2016-11-21 23:40:09 (GMT)
commit0b49f29662de4d4f5a5bbacc90e9791ae794a8dd (patch)
tree7daa9107cf8eaf397cc1c946252ff06216fc07e5
parent19957f9324a5ae45bcb1479f1bb017efa77d0aa7 (diff)
Fix memory leak in OTR plugin
We need to call otrl_tlv_free() when we got non-NULL tlvs from otrl_message_receiving(). This also remove now useless call to otrl_context_find() after otrl_message_receiving().
-rw-r--r--plugins/otr/otrlchatinterface.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/plugins/otr/otrlchatinterface.cpp b/plugins/otr/otrlchatinterface.cpp
index 6e3d417..153fae9 100644
--- a/plugins/otr/otrlchatinterface.cpp
+++ b/plugins/otr/otrlchatinterface.cpp
@@ -596,8 +596,7 @@ int OtrlChatInterface::decryptMessage( Kopete::Message &message){
int ignoremessage = otrl_message_receiving( userstate, &ui_ops, chatSession, accountId.toLocal8Bit(), protocol.toLocal8Bit(), contactId.toLocal8Bit(), body.toLocal8Bit(), &newMessage, &tlvs, NULL, NULL, NULL );
- ConnContext *context = otrl_context_find( userstate, contactId.toLocal8Bit(), accountId.toLocal8Bit(), protocol.toLocal8Bit(), 0, 0, NULL, NULL, NULL);
- if (context) {
+ if (tlvs) {
OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
if( tlv ){
Kopete::Message msg( chatSession->members().first(), chatSession->account()->myself() );
@@ -605,10 +604,8 @@ int OtrlChatInterface::decryptMessage( Kopete::Message &message){
msg.setDirection( Kopete::Message::Internal );
chatSession->appendMessage( msg );
OtrlChatInterface::self()->emitGoneSecure( chatSession, 3 );
-
- otrl_tlv_free(tlvs);
}
-
+ otrl_tlv_free(tlvs);
}
// message is now decrypted or is a Plaintext message and ready to deliver