From dea7c774b43be9e8428d9a584f3d124bd63fe099 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 21 Aug 2015 20:45:41 -0400 Subject: [PATCH] fixed missing removal of deleted data causing a crash when large messages cause an error in Global Router --- libretroshare/src/grouter/p3grouter.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/grouter/p3grouter.cc b/libretroshare/src/grouter/p3grouter.cc index 77bcdad05..421d2c97c 100644 --- a/libretroshare/src/grouter/p3grouter.cc +++ b/libretroshare/src/grouter/p3grouter.cc @@ -587,7 +587,8 @@ RsGRouterAbstractMsgItem *GRouterDataInfo::addDataChunk(RsGRouterTransactionChun std::cerr << " ERROR: chunk numbering is wrong. Dropping." << std::endl; delete chunk ; delete incoming_data_buffer ; - return NULL; + incoming_data_buffer = NULL ; + return NULL; } incoming_data_buffer->chunk_data = (uint8_t*)realloc((uint8_t*)incoming_data_buffer->chunk_data,incoming_data_buffer->chunk_size + chunk->chunk_size) ; memcpy(&incoming_data_buffer->chunk_data[incoming_data_buffer->chunk_size],chunk->chunk_data,chunk->chunk_size) ;