Author: tabish
Date: Thu May 20 15:43:10 2010
New Revision: 946675

URL: http://svn.apache.org/viewvc?rev=946675&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-140

Fix memory leak in test

Modified:
    
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp
    
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/ssl/SSLSocketFactoryTest.cpp

Modified: 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp
URL: 
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp?rev=946675&r1=946674&r2=946675&view=diff
==============================================================================
--- 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp
 (original)
+++ 
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp
 Thu May 20 15:43:10 2010
@@ -40,7 +40,9 @@
 
 #ifdef HAVE_OPENSSL
 #include <openssl/ssl.h>
+#include <openssl/evp.h>
 #include <openssl/rand.h>
+#include <openssl/conf.h>
 #define SSL_LOCK_MUTEX CRYPTO_LOCK
 #else
 #define SSL_LOCK_MUTEX 1
@@ -169,7 +171,9 @@ void OpenSSLContextSpi::providerInit( Se
 #ifdef HAVE_OPENSSL
 
         // General library initialization.
+    #ifdef WIN32
         CRYPTO_malloc_init();
+    #endif
         SSL_load_error_strings();
         SSL_library_init();
         OpenSSL_add_all_algorithms();

Modified: 
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/ssl/SSLSocketFactoryTest.cpp
URL: 
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/ssl/SSLSocketFactoryTest.cpp?rev=946675&r1=946674&r2=946675&view=diff
==============================================================================
--- 
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/ssl/SSLSocketFactoryTest.cpp
 (original)
+++ 
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/net/ssl/SSLSocketFactoryTest.cpp
 Thu May 20 15:43:10 2010
@@ -42,9 +42,8 @@ void SSLSocketFactoryTest::testGetDefaul
 
 #ifdef HAVE_OPENSSL
 
-    Socket* sock = factory->createSocket();
-    CPPUNIT_ASSERT( sock != NULL );
-    delete sock;
+    std::auto_ptr<Socket> sock( factory->createSocket() );
+    CPPUNIT_ASSERT( sock.get() != NULL );
 
 #else
 


Reply via email to