forked from boostorg/core
Added a check for NULL pointer in fclose_deleter.
The deleter can be called on a null pointer by shared_ptr. Also added tests with unique_ptr from Boost.Move and shared_ptr from Boost.SmartPtr.
This commit is contained in:
1 parent
3510f6244b
commit
00f4f11f14
3 files changed
+30
-8
No files matched your search
@@ -36,7 +36,8 @@ struct fclose_deleter
|
||||
*/
|
||||
void operator() (std::FILE* p) const BOOST_NOEXCEPT
|
||||
{
|
||||
std::fclose(p);
|
||||
if (BOOST_LIKELY(!!p))
|
||||
std::fclose(p);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user