Skip to content

Commit 39aa10d

Browse files
author
jzmaddock
committed
Fix for: #9
1 parent f6a9bce commit 39aa10d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/fileiter.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,15 @@ void mapfile::lock(pointer* node)const
267267
read_size = std::fread(*node + sizeof(int), _size % buf_size, 1, hfile);
268268
else
269269
read_size = std::fread(*node + sizeof(int), buf_size, 1, hfile);
270-
#ifndef BOOST_NO_EXCEPTIONS
271270
if((read_size == 0) || (std::ferror(hfile)))
272271
{
272+
#ifndef BOOST_NO_EXCEPTIONS
273+
unlock(node);
273274
throw std::runtime_error("Unable to read file.");
274-
}
275275
#else
276-
BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0));
276+
BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0));
277277
#endif
278+
}
278279
}
279280
else
280281
{

0 commit comments

Comments
 (0)