diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp index 01d8427ef1915f2934a9eea669ea0528e2490a68..72e832f85cfcdbed5b1c1c08fc7bfda8cb503140 100644 --- a/daemon/src/sip/sipaccount.cpp +++ b/daemon/src/sip/sipaccount.cpp @@ -66,7 +66,7 @@ SIPAccount::SIPAccount(const std::string& accountID) , serviceRoute_() , tlsListenerPort_(DEFAULT_SIP_TLS_PORT) , transportType_(PJSIP_TRANSPORT_UNSPECIFIED) - , cred_(NULL) + , cred_() , tlsSetting_() , contactHeader_() , contactUpdateEnabled_(false) @@ -101,11 +101,6 @@ SIPAccount::SIPAccount(const std::string& accountID) , link_(SIPVoIPLink::instance()) {} -SIPAccount::~SIPAccount() -{ - delete [] cred_; -} - void SIPAccount::serialize(Conf::YamlEmitter *emitter) { using namespace Conf; @@ -927,11 +922,9 @@ void SIPAccount::setCredentials(const std::vector<std::map<std::string, std::str } // Create the credential array - delete[] cred_; - cred_ = new pjsip_cred_info[credentials_.size()]; + cred_.resize(credentials_.size()); size_t i = 0; - for (vector<map<string, string > >::const_iterator iter = credentials_.begin(); iter != credentials_.end(); ++iter) { map<string, string>::const_iterator val = (*iter).find(CONFIG_ACCOUNT_PASSWORD); diff --git a/daemon/src/sip/sipaccount.h b/daemon/src/sip/sipaccount.h index 7f2596db839095015ba3cd0f2ed3b44b90d6e6c2..2b9a408728351130831d05d0d64ac058943eb8eb 100644 --- a/daemon/src/sip/sipaccount.h +++ b/daemon/src/sip/sipaccount.h @@ -110,11 +110,6 @@ class SIPAccount : public Account { */ SIPAccount(const std::string& accountID); - /** - * Virtual destructor - */ - virtual ~SIPAccount(); - virtual VoIPLink* getVoIPLink(); std::string getUserAgentName() const; @@ -196,8 +191,8 @@ class SIPAccount : public Account { void stopKeepAliveTimer(); - pjsip_cred_info *getCredInfo() const { - return cred_; + const pjsip_cred_info* getCredInfo() const { + return &(*cred_.begin()); } /** @@ -605,7 +600,7 @@ class SIPAccount : public Account { /** * Credential information stored for further registration. */ - pjsip_cred_info *cred_; + std::vector<pjsip_cred_info> cred_; /** * The TLS settings, used only if tls is chosen as a sip transport.