From 79e2f7c0987f7ab8045a318d5a16ae5a42b135c6 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Thu, 16 Jun 2022 08:18:59 +0800 Subject: [PATCH] unmap file when throw exception --- chunkedstorage.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chunkedstorage.cc b/chunkedstorage.cc index ff129f81..3133b651 100644 --- a/chunkedstorage.cc +++ b/chunkedstorage.cc @@ -160,7 +160,10 @@ char * Reader::getBlock( uint32_t address, vector< char > & chunk ) if( uncompress( (unsigned char *)&chunk.front(), &decompressedLength, chunkDataBytes, compressedSize ) != Z_OK || decompressedLength != chunk.size() ) + { + file.unmap( chunkDataBytes ); throw exFailedToDecompressChunk(); + } file.unmap( chunkDataBytes ); }