title: boost asio set_verify_callback leaks shared_ptr
body: <p>I'm seeing a leak when using set_verify_callback on an ssl socket. I have a class "CClientSock" with  member "boost::asio::ssl::stream m_socket;"</p>
  
  <p>My CClientSock class derives from 'enable_shared_from_this</p>
  
  <pre>
  
      class CClientSock : public boost::enable_shared_from_this
  
  </pre>
  
  <p>If I call:</p>
  
  <pre>
  
      m_socket.set_verify_callback(
          boost::bind(&CClientSock::verify_certificate, 
          shared_from_this(),
          _1, 
          _2));
  
  </pre>
  
  <p>then my CClientSock instance is never destroyed.</p>
  
  <p>If I do not call the "m_socket.set_verify_callback" then my CClientSock instance is destroyed correctly.</p>
  
  <p>The code looks like this:</p>
  
  <pre>
  
      void CClientSock::StartPoll()
      {
      m_socket.set_verify_mode(boost::asio::ssl::verify_peer | 
          boost::asio::ssl::verify_fail_if_no_peer_cert);
  
      m_socket.set_verify_callback(
          boost::bind(&CClientSock::verify_certificate, 
          shared_from_this(),
          _1, 
          _2));
  
  
      boost::asio::ip::tcp::resolver::iterator endpoint_iterator;
      endpoint_iterator = ResolveAddress("xxx.xxx.xxx.xxx", nPort);
  
      boost::asio::async_connect(
          m_socket.lowest_layer(), 
          endpoint_iterator,
          boost::bind(&CClientSock::handle_connect, 
          shared_from_this(),
          boost::asio::placeholders::error));
      }
  
      bool CClientSock::verify_certificate(
          bool preverified,
          boost::asio::ssl::verify_context& ctx
      )
      {
      char subject_name[256];
      X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
      X509_NAME_oneline(X509_get_subject_name(cert), subject_name, 256);
  
      SYSTEMTIME st;
      GetLocalTime(&st);
      CString s;
      s.Format("%02d SSL Verify: %s", m_nId, subject_name);
      LogMsg(m_dwThreadId, &st, s, 0, NULL);
  
      return preverified;
      }
  
  </pre>
  
  <p>Is there something that has to be done in "set_verify_callback" to release a reference?</p>