activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1419873 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core: AdvisoryConsumer.cpp kernels/ActiveMQSessionKernel.cpp
Date Mon, 10 Dec 2012 23:38:31 GMT
Author: tabish
Date: Mon Dec 10 23:38:30 2012
New Revision: 1419873

URL: http://svn.apache.org/viewvc?rev=1419873&view=rev
Log:
Fix some memory that can occur when exceptions are thrown.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp?rev=1419873&r1=1419872&r2=1419873&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/AdvisoryConsumer.cpp Mon
Dec 10 23:38:30 2012
@@ -62,16 +62,20 @@ AdvisoryConsumer::AdvisoryConsumer(Activ
 
     this->config->info.reset(new ConsumerInfo());
 
-    Pointer<ActiveMQDestination> destination(AdvisorySupport::getTempDestinationCompositeAdvisoryTopic());
-
     this->config->info->setConsumerId(consumerId);
-    this->config->info->setDestination(destination);
+    this->config->info->setDestination(
+        Pointer<ActiveMQDestination>(AdvisorySupport::getTempDestinationCompositeAdvisoryTopic()));
     this->config->info->setPrefetchSize(1000);
     this->config->info->setNoLocal(true);
     this->config->info->setDispatchAsync(true);
 
-    this->connection->addDispatcher(this->config->info->getConsumerId(), this);
-    this->connection->syncRequest(this->config->info);
+    try {
+        this->connection->addDispatcher(this->config->info->getConsumerId(),
this);
+        this->connection->syncRequest(this->config->info);
+    } catch(...) {
+        delete this->config;
+        throw;
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp?rev=1419873&r1=1419872&r2=1419873&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
Mon Dec 10 23:38:30 2012
@@ -212,7 +212,13 @@ ActiveMQSessionKernel::ActiveMQSessionKe
     this->sessionInfo->setAckMode(ackMode);
     this->sessionInfo->setSessionId(id);
 
-    this->connection->oneway(this->sessionInfo);
+    try {
+        this->connection->oneway(this->sessionInfo);
+    } catch (...) {
+        this->sessionInfo.reset(NULL);
+        delete this->config;
+        throw;
+    }
 
     this->closed.set(false);
     this->lastDeliveredSequenceId = -1;



Mime
View raw message