mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
fixed bug due to not using realloc correctly (thanks valgrind)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6385 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0d3d8ed2bd
commit
b4f26dcf8f
2 changed files with 7 additions and 10 deletions
|
@ -820,11 +820,14 @@ bool PGPHandler::importGPGKeyPair(const std::string& filename,PGPIdType& importe
|
|||
|
||||
void PGPHandler::addNewKeyToOPSKeyring(ops_keyring_t *kr,const ops_keydata_t& key)
|
||||
{
|
||||
kr->keys = (ops_keydata_t*)realloc(kr->keys,(kr->nkeys+1)*sizeof(ops_keydata_t)) ;
|
||||
if(kr->nkeys >= kr->nkeys_allocated)
|
||||
{
|
||||
kr->keys = (ops_keydata_t *)realloc(kr->keys,(kr->nkeys+1)*sizeof(ops_keydata_t)) ;
|
||||
kr->nkeys_allocated = kr->nkeys+1;
|
||||
}
|
||||
memset(&kr->keys[kr->nkeys],0,sizeof(ops_keydata_t)) ;
|
||||
ops_keydata_copy(&kr->keys[kr->nkeys],&key) ;
|
||||
kr->nkeys++ ;
|
||||
kr->nkeys_allocated = kr->nkeys ;
|
||||
}
|
||||
|
||||
bool PGPHandler::LoadCertificateFromString(const std::string& pgp_cert,PGPIdType& id,std::string& error_string)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue