diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageInputSvc.cxx b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageInputSvc.cxx index 1b3dd397191f21340609abecc712f68353c9a89a..8a81b365194775e6ae0441cfb094329590aa32ad 100644 --- a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageInputSvc.cxx +++ b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageInputSvc.cxx @@ -355,7 +355,7 @@ ByteStreamEventStorageInputSvc::buildFragment( // convert old fragment if(formatVersion != eformat::MAJOR_DEFAULT_VERSION) { // 100 for increase of data-size due to header conversion - DataType newEventSize = eventSize + 1000; + const uint32_t newEventSize = eventSize + 1000; DataType* newFragment = new DataType[newEventSize]; eformat::old::convert(fragment, newFragment, newEventSize); @@ -464,15 +464,21 @@ ByteStreamEventStorageInputSvc::EventCache::releaseEvent() { // cleanup parts of previous event and re-init them if(rawEvent) { - OFFLINE_FRAGMENTS_NAMESPACE::PointerType fragment = 0; - rawEvent->start(fragment); - delete [] fragment; fragment = 0; + OFFLINE_FRAGMENTS_NAMESPACE::PointerType fragment = rawEvent->start(); + delete [] fragment; fragment = nullptr; rawEvent.reset(nullptr); eventStatus = 0; } } +/******************************************************************************/ +ByteStreamEventStorageInputSvc::EventCache::~EventCache() +{ + releaseEvent(); +} + + /******************************************************************************/ void ByteStreamEventStorageInputSvc::closeBlockIterator(bool clearMetadata) diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageInputSvc.h b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageInputSvc.h index df0ef8311d5b8159ec7be67c54057a0c635909c5..7385c5cb4b8576fb69f91f1de47f6355f5e5708e 100644 --- a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageInputSvc.h +++ b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageInputSvc.h @@ -75,7 +75,8 @@ private: // data std::unique_ptr<RawEvent> rawEvent = nullptr; //!< current event unsigned int eventStatus = 0; //!< check_tree() status of the current event long long int eventOffset = 0; //!< event offset within a file, can be -1 - void releaseEvent(); + void releaseEvent(); //!< deletes fragments and raw event + virtual ~EventCache(); //!< calls releaseEvent }; SG::SlotSpecificObj<EventCache> m_eventsCache;