From 1011b6a367f4a8089f5098937eb73855db601593 Mon Sep 17 00:00:00 2001 From: Gaurav Date: Wed, 31 Dec 2014 10:48:46 +0530 Subject: [PATCH] Fix exception safety. At line no:251 node is allocated. In case of exception throw or assert , it should be deleted. --- src/fileiter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fileiter.cpp b/src/fileiter.cpp index 780a12f16..842b57d16 100644 --- a/src/fileiter.cpp +++ b/src/fileiter.cpp @@ -270,9 +270,11 @@ void mapfile::lock(pointer* node)const #ifndef BOOST_NO_EXCEPTIONS if((read_size == 0) || (std::ferror(hfile))) { + condemed.remove(node); throw std::runtime_error("Unable to read file."); } #else + condemed.remove(node); BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0)); #endif }