memory leaks from missing gpgme_data_release

- AuthGPG::privateSignCertificate
- AuthGPG::privateTrustCertificate


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3160 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-06-18 22:58:27 +00:00
parent 09ac44316a
commit 19674c4d86

View File

@ -1439,14 +1439,17 @@ int AuthGPG::privateSignCertificate(std::string id)
gpgme_signers_clear(CTX); gpgme_signers_clear(CTX);
if(GPG_ERR_NO_ERROR != (ERR = gpgme_signers_add(CTX, ownKey))) { if(GPG_ERR_NO_ERROR != (ERR = gpgme_signers_add(CTX, ownKey))) {
gpgme_data_release(out);
return 0; return 0;
} }
if(GPG_ERR_NO_ERROR != (ERR = gpgme_op_edit(CTX, signKey, keySignCallback, &params, out))) { if(GPG_ERR_NO_ERROR != (ERR = gpgme_op_edit(CTX, signKey, keySignCallback, &params, out))) {
gpgme_data_release(out);
return 0; return 0;
} }
gpgme_data_release(out);
return 1; return 1;
} }
@ -1466,32 +1469,35 @@ int AuthGPG::privateTrustCertificate(std::string id, int trustlvl)
return 0; return 0;
} }
{ {
RsStackMutex stack(gpgMtx); RsStackMutex stack(gpgMtx);
gpgcert trustCert = mKeyList.find(id)->second; gpgcert trustCert = mKeyList.find(id)->second;
gpgme_key_t trustKey = trustCert.key; gpgme_key_t trustKey = trustCert.key;
std::string trustString; std::string trustString;
std::ostringstream trustStrOut; std::ostringstream trustStrOut;
trustStrOut << trustlvl; trustStrOut << trustlvl;
class TrustParams sparams(trustStrOut.str()); class TrustParams sparams(trustStrOut.str());
class EditParams params(TRUST_START, &sparams); class EditParams params(TRUST_START, &sparams);
gpgme_data_t out; gpgme_data_t out;
gpg_error_t ERR; gpg_error_t ERR;
if(GPG_ERR_NO_ERROR != (ERR = gpgme_data_new(&out))) {
return 0;
}
if(GPG_ERR_NO_ERROR != (ERR = gpgme_data_new(&out))) { if(GPG_ERR_NO_ERROR != (ERR = gpgme_op_edit(CTX, trustKey, trustCallback, &params, out))) {
return 0; gpgme_data_release(out);
} return 0;
}
if(GPG_ERR_NO_ERROR != (ERR = gpgme_op_edit(CTX, trustKey, trustCallback, &params, out))) gpgme_data_release(out);
return 0;
//the key ref has changed, we got to get rid of the old reference. //the key ref has changed, we got to get rid of the old reference.
trustCert.key = NULL; trustCert.key = NULL;
} }
storeAllKeys_locked(); storeAllKeys_locked();
return 1; return 1;
} }