In the code sample on page 299 and 300 there is a memory leak. While std::default_delete<DATABASE_PROXY>::operator() calls close_database(*p), it does not call delete p. I.e. it does not destroy the object of type DATABASE_PROXY that gets constructed on page 300 when calling new DATABASE_PROXY(....
In the code sample on page 299 and 300 there is a memory leak. While
std::default_delete<DATABASE_PROXY>::operator()
callsclose_database(*p)
, it does not calldelete p
. I.e. it does not destroy the object of typeDATABASE_PROXY
that gets constructed on page 300 when callingnew DATABASE_PROXY(...
.Label: 5.6: E6