diff options
-rw-r--r-- | src/net/tls/TLSSocket.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/net/tls/TLSSocket.cpp b/src/net/tls/TLSSocket.cpp index 06736677..cc922796 100644 --- a/src/net/tls/TLSSocket.cpp +++ b/src/net/tls/TLSSocket.cpp @@ -355,7 +355,7 @@ ref <security::cert::certificateChain> TLSSocket::getPeerCertificates() const // C and C++ calls. // // gnutls_record_recv() calls TLSSocket::gnutlsPullFunc, and exceptions -// thrown by the socket can not not catched. +// thrown by the socket can not be caught. #ifndef VMIME_BUILDING_DOC @@ -380,10 +380,15 @@ void TLSSocket::internalThrow() if (m_ex) { + // Reset the current exception pointer to prevent the same + // exception from being thrown again later + exception* ex = m_ex; + m_ex = NULL; + // To avoid memory leaks - exToDelete.push_back(vmime::create <TLSSocket_DeleteExWrapper>(m_ex)); + exToDelete.push_back(vmime::create <TLSSocket_DeleteExWrapper>(ex)); - throw *m_ex; + throw *ex; } } |