From 6f4231a1ef6790b65bc785fdc34c5e56c6e8c176 Mon Sep 17 00:00:00 2001 From: richterm Date: Sun, 16 Aug 2009 04:27:51 +0000 Subject: [PATCH] correcting allocation of EventDoneData in order to support multiple calls --- HLT/BASE/AliHLTComponent.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/HLT/BASE/AliHLTComponent.cxx b/HLT/BASE/AliHLTComponent.cxx index 192385081a9..2d8f5978015 100644 --- a/HLT/BASE/AliHLTComponent.cxx +++ b/HLT/BASE/AliHLTComponent.cxx @@ -675,9 +675,11 @@ int AliHLTComponent::ReserveEventDoneData( unsigned long size ) // see header file for function documentation int iResult=0; - - if (size>fEventDoneDataSize) { - AliHLTComponentEventDoneData* newEDD = reinterpret_cast( new AliHLTUInt8_t[ sizeof(AliHLTComponentEventDoneData)+size ] ); + unsigned long capacity=fEventDoneDataSize; + if (fEventDoneData) capacity-=sizeof(AliHLTComponentEventDoneData)+fEventDoneData->fDataSize; + if (size>capacity) { + unsigned long newSize=sizeof(AliHLTComponentEventDoneData)+size+(fEventDoneDataSize-capacity); + AliHLTComponentEventDoneData* newEDD = reinterpret_cast( new AliHLTUInt8_t[newSize] ); if (!newEDD) return -ENOMEM; newEDD->fStructSize = sizeof(AliHLTComponentEventDoneData); @@ -689,7 +691,7 @@ int AliHLTComponent::ReserveEventDoneData( unsigned long size ) delete [] reinterpret_cast( fEventDoneData ); } fEventDoneData = newEDD; - fEventDoneDataSize = size; + fEventDoneDataSize = newSize; } return iResult; @@ -1812,6 +1814,8 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData, // no output blocks, set size to 0 size=0; } + + // reset the internal EventData struct FillEventData(fCurrentEventData); return iResult; } -- 2.43.0