mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
improved temporary memory class
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8094 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e58c9de067
commit
d8b276b7e2
3 changed files with 78 additions and 67 deletions
|
@ -922,9 +922,8 @@ bool p3GRouter::sendDataInTunnel(const TurtleVirtualPeerId& vpid,RsGRouterAbstra
|
|||
#endif
|
||||
|
||||
uint32_t size = item->serial_size();
|
||||
unsigned char *data = NULL ;
|
||||
|
||||
TemporaryMemoryHolder f(data,size) ; // data will be freed on return, whatever the route taken.
|
||||
RsTemporaryMemory data(size) ; // data will be freed on return, whatever the route taken.
|
||||
|
||||
if(data == NULL)
|
||||
{
|
||||
|
@ -1384,9 +1383,7 @@ bool p3GRouter::verifySignedDataItem(RsGRouterAbstractMsgItem *item)
|
|||
RsTlvSecurityKey signature_key ;
|
||||
|
||||
uint32_t data_size = item->signed_data_size() ;
|
||||
uint8_t *data = NULL;
|
||||
|
||||
TemporaryMemoryHolder f(data,data_size) ;
|
||||
RsTemporaryMemory data(data_size) ;
|
||||
|
||||
if(data == NULL)
|
||||
throw std::runtime_error("Cannot allocate data.") ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue