From 5af0716a162e6045cff2a881f6baa61be4c575d1 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 14 Jun 2015 22:34:03 +0000 Subject: [PATCH] Fixed memory leak in DistantChatService::locked_sendDHPublicKey. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8456 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/chat/distantchat.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/chat/distantchat.cc b/libretroshare/src/chat/distantchat.cc index 8a8771c59..5b7460215 100644 --- a/libretroshare/src/chat/distantchat.cc +++ b/libretroshare/src/chat/distantchat.cc @@ -656,15 +656,13 @@ void DistantChatService::handleRecvDHPublicKey(RsChatDHPublicKeyItem *item) bool DistantChatService::locked_sendDHPublicKey(const DH *dh,const RsGxsId& own_gxs_id,const RsPeerId& virtual_peer_id) { - RsChatDHPublicKeyItem *dhitem = new RsChatDHPublicKeyItem ; - if(dh == NULL) { std::cerr << " (EE) DH struct is not initialised! Error." << std::endl; - delete dhitem ; return false ; } + RsChatDHPublicKeyItem *dhitem = new RsChatDHPublicKeyItem ; dhitem->public_key = BN_dup(dh->pub_key) ; // we should also sign the data and check the signature on the other end. @@ -689,6 +687,7 @@ bool DistantChatService::locked_sendDHPublicKey(const DH *dh,const RsGxsId& own_ break ; } free(data) ; + delete(dhitem); return false; } free(data) ;