diff --git a/sp_debug_hooks.cpp b/sp_debug_hooks.cpp index 26d9c51..3d5fb15 100644 --- a/sp_debug_hooks.cpp +++ b/sp_debug_hooks.cpp @@ -159,7 +159,7 @@ static void scan_and_count(void const * area, size_t size, map_type const & m, s { shared_ptr_layout const * q = reinterpret_cast(p); - if(q->pn.id == boost::detail::shared_count_id && m.count(q->pn.pi) != 0) + if(q->pn.id == boost::detail::shared_count_id && q->pn.pi != 0 && m.count(q->pn.pi) != 0) { ++m2[q->pn.pi]; } @@ -175,7 +175,7 @@ static bool scan_and_mark(void const * area, size_t size, map_type const & m, st { shared_ptr_layout const * q = reinterpret_cast(p); - if(q->pn.id == boost::detail::shared_count_id && m.count(q->pn.pi) != 0) + if(q->pn.id == boost::detail::shared_count_id && q->pn.pi != 0 && m.count(q->pn.pi) != 0) { // mark as reachable