mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
added a new method rs_malloc that checks its arguments and prints a stacktrace on error/weird call. Changed the code everywhere to use this instead of malloc. Removed some mallocs and replaced with RsTemporaryMemory
This commit is contained in:
parent
9c6e7dfc13
commit
d13526facd
39 changed files with 274 additions and 132 deletions
|
@ -26,6 +26,7 @@ extern "C" {
|
|||
#include "retroshare/rspeers.h" // For rsicontrol.
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsdiscspace.h"
|
||||
#include "util/rsmemory.h"
|
||||
#include "pgp/pgpkeyutil.h"
|
||||
|
||||
static const uint32_t PGP_CERTIFICATE_LIMIT_MAX_NAME_SIZE = 64 ;
|
||||
|
@ -39,13 +40,11 @@ PassphraseCallback PGPHandler::_passphrase_callback = NULL ;
|
|||
|
||||
ops_keyring_t *PGPHandler::allocateOPSKeyring()
|
||||
{
|
||||
ops_keyring_t *kr = (ops_keyring_t*)malloc(sizeof(ops_keyring_t)) ;
|
||||
ops_keyring_t *kr = (ops_keyring_t*)rs_safe_malloc(sizeof(ops_keyring_t)) ;
|
||||
|
||||
if(kr == NULL)
|
||||
{
|
||||
std::cerr << "(EE) Cannot allocate memory for " << sizeof(ops_keyring_t) << " bytes in " << __PRETTY_FUNCTION__ << std::endl;
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
kr->nkeys = 0 ;
|
||||
kr->nkeys_allocated = 0 ;
|
||||
kr->keys = 0 ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue