From a3bf37fb4f758469b7b68ad7dcca170913fcd912 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 8 Dec 2009 10:03:34 +0000 Subject: Fixed not exception-safe constructor, which could lead to possible memory leak (thanks to Bartek Szurgot). Get rid of const-ness on factories. --- src/platforms/windows/windowsHandler.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/platforms/windows/windowsHandler.cpp') diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp index 404d3cbc..1a37c839 100644 --- a/src/platforms/windows/windowsHandler.cpp +++ b/src/platforms/windows/windowsHandler.cpp @@ -49,17 +49,13 @@ windowsHandler::windowsHandler() m_socketFactory = vmime::create (); #endif #if VMIME_HAVE_FILESYSTEM_FEATURES - m_fileSysFactory = new windowsFileSystemFactory(); + m_fileSysFactory = vmime::create (); #endif } windowsHandler::~windowsHandler() { -#if VMIME_HAVE_FILESYSTEM_FEATURES - delete (m_fileSysFactory); -#endif - WSACleanup(); } @@ -240,9 +236,9 @@ unsigned int windowsHandler::getProcessId() const #if VMIME_HAVE_MESSAGING_FEATURES -ref windowsHandler::getSocketFactory() const +ref windowsHandler::getSocketFactory() { - return m_socketFactory.dynamicCast (); + return m_socketFactory; } #endif @@ -250,13 +246,13 @@ ref windowsHandler::getSocketFactory() const #if VMIME_HAVE_FILESYSTEM_FEATURES -vmime::utility::fileSystemFactory* windowsHandler::getFileSystemFactory() const +ref windowsHandler::getFileSystemFactory() { - return (m_fileSysFactory); + return m_fileSysFactory; } -vmime::utility::childProcessFactory* windowsHandler::getChildProcessFactory() const +ref windowsHandler::getChildProcessFactory() { // TODO: Not implemented return (NULL); -- cgit v1.2.3