From e5433801093970abd30c17f34b0957a748a8aefb Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Mon, 7 Jul 2014 15:24:11 +0000 Subject: NO-JIRA: Fix defects found by coverity. To view the defects in Coverity Scan visit, http://scan.coverity.com/projects/6?tab=overview ** CID 1224524: Big parameter passed by value (PASS_BY_VALUE) /qpidbuilds/trunk/qpid/cpp/src/tests/BrokerFixture.h: 155 in qpid::tests::SessionFixtureT::SessionFixtureT(qpid::broker::BrokerOptions)() ** CID 1224525: Big parameter passed by value (PASS_BY_VALUE) /qpidbuilds/trunk/qpid/cpp/src/tests/ClientSessionTest.cpp: 108 in qpid::tests::ClientSessionFixture::ClientSessionFixture(qpid::broker::BrokerOptions)() ** CID 1224526: Big parameter passed by value (PASS_BY_VALUE) /qpidbuilds/trunk/qpid/cpp/src/tests/MessagingFixture.h: 106 in qpid::tests::MessagingFixture::MessagingFixture(qpid::broker::BrokerOptions, bool)() ** CID 1224527: Wrapper object use after free (WRAPPER_ESCAPE) /qpidbuilds/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp: 276 in qpid::broker::CyrusAuthenticator::init()() git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1608487 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp | 4 ++-- qpid/cpp/src/tests/BrokerFixture.h | 2 +- qpid/cpp/src/tests/ClientSessionTest.cpp | 2 +- qpid/cpp/src/tests/MessagingFixture.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp b/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp index ca33b49249..76774ec257 100644 --- a/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp +++ b/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp @@ -272,10 +272,10 @@ void CyrusAuthenticator::init() */ int code; - const char *realm = connection.getBroker().getRealm().c_str(); + std::string realm = connection.getBroker().getRealm(); code = sasl_server_new(BROKER_SASL_NAME, /* Service name */ NULL, /* Server FQDN, gethostname() */ - realm, /* Authentication realm */ + realm.c_str(), /* Authentication realm */ NULL, /* Local IP, needed for some mechanism */ NULL, /* Remote IP, needed for some mechanism */ NULL, /* Callbacks */ diff --git a/qpid/cpp/src/tests/BrokerFixture.h b/qpid/cpp/src/tests/BrokerFixture.h index 90b2dc47e0..9cf325587a 100644 --- a/qpid/cpp/src/tests/BrokerFixture.h +++ b/qpid/cpp/src/tests/BrokerFixture.h @@ -152,7 +152,7 @@ typedef ClientT<> Client; template struct SessionFixtureT : BrokerFixture, ClientT { - SessionFixtureT(BrokerOptions opts=BrokerOptions()) : + SessionFixtureT(const BrokerOptions& opts=BrokerOptions()) : BrokerFixture(BrokerFixture::Args(), opts), ClientT(getPort()) {} diff --git a/qpid/cpp/src/tests/ClientSessionTest.cpp b/qpid/cpp/src/tests/ClientSessionTest.cpp index 6cd63e7f04..f35524c0c0 100644 --- a/qpid/cpp/src/tests/ClientSessionTest.cpp +++ b/qpid/cpp/src/tests/ClientSessionTest.cpp @@ -105,7 +105,7 @@ struct SimpleListener : public MessageListener struct ClientSessionFixture : public SessionFixture { - ClientSessionFixture(BrokerOptions opts = BrokerOptions()) : SessionFixture(opts) { + ClientSessionFixture(const BrokerOptions& opts = BrokerOptions()) : SessionFixture(opts) { session.queueDeclare(arg::queue="my-queue"); } }; diff --git a/qpid/cpp/src/tests/MessagingFixture.h b/qpid/cpp/src/tests/MessagingFixture.h index 2d780fea14..165aefeeec 100644 --- a/qpid/cpp/src/tests/MessagingFixture.h +++ b/qpid/cpp/src/tests/MessagingFixture.h @@ -103,7 +103,7 @@ struct MessagingFixture : public BrokerFixture messaging::Session session; BrokerAdmin admin; - MessagingFixture(BrokerOptions opts = BrokerOptions(), bool mgmtEnabled=false) : + MessagingFixture(const BrokerOptions& opts = BrokerOptions(), bool mgmtEnabled=false) : BrokerFixture(opts, mgmtEnabled), connection(open(broker->getPort(Broker::TCP_TRANSPORT))), session(connection.createSession()), -- cgit v1.2.1