thunders patch, mem leak, and ignored return vals

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3350 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2010-08-08 12:46:24 +00:00
parent cf75bee791
commit 9ff6849a55
2 changed files with 21 additions and 5 deletions

View File

@ -1470,7 +1470,6 @@ bool p3GroupDistrib::loadList(std::list<RsItem *> load)
/* for child config data */ /* for child config data */
std::list<RsItem* > childLoadL; std::list<RsItem* > childLoadL;
RsSerialType* childSer = createSerialiser(); RsSerialType* childSer = createSerialiser();
uint32_t pktSize;
for(lit = load.begin(); lit != load.end(); lit++) for(lit = load.begin(); lit != load.end(); lit++)
{ {
@ -2205,7 +2204,9 @@ std::string p3GroupDistrib::publishMsg(RsDistribMsg *msg, bool personalSign)
delete[] data; delete[] data;
}else{ }else{
delete[] data;
delete signedMsg;
delete serialType;
return msgId; return msgId;
} }
@ -2233,6 +2234,8 @@ std::string p3GroupDistrib::publishMsg(RsDistribMsg *msg, bool personalSign)
signedMsg->publishSignature.signData.setBinData(sigbuf, siglen); signedMsg->publishSignature.signData.setBinData(sigbuf, siglen);
signedMsg->publishSignature.keyId = gi->publishKeyId; signedMsg->publishSignature.keyId = gi->publishKeyId;
bool ok = true;
if (personalSign) if (personalSign)
{ {
unsigned int siglen = MAX_GPG_SIGNATURE_SIZE; unsigned int siglen = MAX_GPG_SIGNATURE_SIZE;
@ -2241,6 +2244,8 @@ std::string p3GroupDistrib::publishMsg(RsDistribMsg *msg, bool personalSign)
{ {
signedMsg->personalSignature.signData.setBinData(sigbuf, siglen); signedMsg->personalSignature.signData.setBinData(sigbuf, siglen);
signedMsg->personalSignature.keyId = AuthGPG::getAuthGPG()->getGPGOwnId(); signedMsg->personalSignature.keyId = AuthGPG::getAuthGPG()->getGPGOwnId();
} else {
ok = false;
} }
} }
@ -2249,6 +2254,11 @@ std::string p3GroupDistrib::publishMsg(RsDistribMsg *msg, bool personalSign)
EVP_MD_CTX_destroy(mdctx); EVP_MD_CTX_destroy(mdctx);
delete[] out_data; delete[] out_data;
if (ok == false) {
delete signedMsg;
return msgId;
}
} /* END STACK MUTEX */ } /* END STACK MUTEX */
/* extract Ids from publishSignature */ /* extract Ids from publishSignature */

View File

@ -224,9 +224,6 @@ bool p3Forums::getForumThreadMsgList(std::string fId, std::string pId, std::list
bool p3Forums::getForumMessage(std::string fId, std::string mId, ForumMsgInfo &info) bool p3Forums::getForumMessage(std::string fId, std::string mId, ForumMsgInfo &info)
{ {
std::list<std::string> msgIds;
std::list<std::string>::iterator it;
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/ RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
RsDistribMsg *msg = locked_getGroupMsg(fId, mId); RsDistribMsg *msg = locked_getGroupMsg(fId, mId);
@ -265,6 +262,10 @@ bool p3Forums::ForumMessageSend(ForumMsgInfo &info)
std::string mId = createForumMsg(info.forumId, info.parentId, std::string mId = createForumMsg(info.forumId, info.parentId,
info.title, info.msg, signIt); info.title, info.msg, signIt);
if (mId.empty()) {
return false;
}
setMessageStatus(info.forumId, mId, FORUM_MSG_STATUS_READ); setMessageStatus(info.forumId, mId, FORUM_MSG_STATUS_READ);
return true; return true;
@ -326,6 +327,11 @@ std::string p3Forums::createForumMsg(std::string fId, std::string pId,
fmsg->timestamp = time(NULL); fmsg->timestamp = time(NULL);
std::string msgId = publishMsg(fmsg, signIt); std::string msgId = publishMsg(fmsg, signIt);
if (msgId.empty()) {
delete(fmsg);
}
return msgId; return msgId;
} }