mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
fixed free/delete mess in GRouter
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-NewGRouterModel@7863 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e0308eacd2
commit
5967ee535f
6 changed files with 32 additions and 15 deletions
|
@ -1235,7 +1235,7 @@ bool p3GRouter::encryptDataItem(RsGRouterGenericDataItem *item,const RsGxsId& de
|
|||
return false ;
|
||||
}
|
||||
|
||||
delete[] item->data_bytes ;
|
||||
free(item->data_bytes) ;
|
||||
item->data_bytes = encrypted_data ;
|
||||
item->data_size = encrypted_size ;
|
||||
item->flags |= RS_GROUTER_DATA_FLAGS_ENCRYPTED ;
|
||||
|
@ -1279,7 +1279,7 @@ bool p3GRouter::decryptDataItem(RsGRouterGenericDataItem *item)
|
|||
return false ;
|
||||
}
|
||||
|
||||
delete[] item->data_bytes ;
|
||||
free(item->data_bytes) ;
|
||||
item->data_bytes = decrypted_data ;
|
||||
item->data_size = decrypted_size ;
|
||||
item->flags &= ~RS_GROUTER_DATA_FLAGS_ENCRYPTED ;
|
||||
|
@ -1410,7 +1410,7 @@ bool p3GRouter::cancel(GRouterMsgPropagationId mid)
|
|||
return true ;
|
||||
}
|
||||
|
||||
bool p3GRouter::sendData(const RsGxsId& destination,const GRouterServiceId& client_id,uint8_t *data, uint32_t data_size,const RsGxsId& signing_id, GRouterMsgPropagationId &propagation_id)
|
||||
bool p3GRouter::sendData(const RsGxsId& destination,const GRouterServiceId& client_id,const uint8_t *data, uint32_t data_size,const RsGxsId& signing_id, GRouterMsgPropagationId &propagation_id)
|
||||
{
|
||||
if(data_size > MAX_GROUTER_DATA_SIZE)
|
||||
{
|
||||
|
@ -1428,7 +1428,9 @@ bool p3GRouter::sendData(const RsGxsId& destination,const GRouterServiceId& clie
|
|||
|
||||
RsGRouterGenericDataItem *data_item = new RsGRouterGenericDataItem ;
|
||||
|
||||
data_item->data_bytes = data ;
|
||||
data_item->data_bytes = (uint8_t*)malloc(data_size) ;
|
||||
memcpy(data_item->data_bytes,data,data_size) ;
|
||||
|
||||
data_item->data_size = data_size ;
|
||||
data_item->routing_id = propagation_id ;
|
||||
data_item->randomized_distance = 0 ;
|
||||
|
|
|
@ -122,8 +122,9 @@ public:
|
|||
// the memory. That means item_data will be erase on return. The returned id should be
|
||||
// remembered by the client, so that he knows when the data has been received.
|
||||
// The client id is supplied so that the client can be notified when the data has been received.
|
||||
// Data is not modified by the global router.
|
||||
//
|
||||
virtual bool sendData(const RsGxsId& destination, const GRouterServiceId& client_id, uint8_t *data, uint32_t data_size, const RsGxsId& signing_id, GRouterMsgPropagationId& id) ;
|
||||
virtual bool sendData(const RsGxsId& destination, const GRouterServiceId& client_id, const uint8_t *data, uint32_t data_size, const RsGxsId& signing_id, GRouterMsgPropagationId& id) ;
|
||||
|
||||
// Cancels a given sending order. If called too late, the message might already have left. But this will remove the item from the
|
||||
// re-try list.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue