From 80663945388669b8123b1c3411afdb108e6aea22 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Fri, 10 Aug 2007 09:04:18 +0000 Subject: [PATCH] Reset exception pointer (thanks to Emmanuel Cabestan). --- src/net/tls/TLSSocket.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 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 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) { - // To avoid memory leaks - exToDelete.push_back(vmime::create (m_ex)); + // Reset the current exception pointer to prevent the same + // exception from being thrown again later + exception* ex = m_ex; + m_ex = NULL; - throw *m_ex; + // To avoid memory leaks + exToDelete.push_back(vmime::create (ex)); + + throw *ex; } }