diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c
index 93f556b8e2a525a248249be54fed392ed08771f5..3ccee962ba4f2f016e42b3f645b6bb29689fc609 100644
--- a/sflphone-client-gnome/src/dbus/dbus.c
+++ b/sflphone-client-gnome/src/dbus/dbus.c
@@ -1206,6 +1206,7 @@ dbus_set_credential (account_t *a, int index)
         g_error_free (error);
     }
 }
+
 void
 dbus_delete_all_credential (account_t *a)
 {
diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp
index d0cb8fc978a2abf7faeece6950ff59ef168fb925..42393554ac550d68dd85b3fb1c501fd77d8088f7 100644
--- a/sflphone-common/src/sip/sipaccount.cpp
+++ b/sflphone-common/src/sip/sipaccount.cpp
@@ -52,20 +52,17 @@ void Credentials::setNewCredential (const std::string &username,
     credentialArray[credentialCount].username = username;
     credentialArray[credentialCount].password = password;
     credentialArray[credentialCount].realm = realm;
-
 }
 
-const CredentialItem *Credentials::getCredential (int index) const
+const CredentialItem *Credentials::getCredential (unsigned index) const
 {
-    if ( (index >= 0) && (index < credentialCount))
-        return & (credentialArray[index]);
-    else
-        return NULL;
+    if (index >= credentialCount)
+		return NULL;
+    return &credentialArray[index];
 }
 
 void Credentials::serialize (Conf::YamlEmitter *emitter UNUSED)
 {
-
 }
 
 void Credentials::unserialize (Conf::MappingNode *map)
@@ -76,8 +73,6 @@ void Credentials::unserialize (Conf::MappingNode *map)
         credentialCount = atoi (val->getValue().data());
 }
 
-
-
 SIPAccount::SIPAccount (const AccountID& accountID)
     : Account (accountID, "SIP")
     , _routeSet ("")
@@ -791,22 +786,28 @@ void SIPAccount::setVoIPLink()
 }
 
 
-int SIPAccount::initCredential (void)
+void SIPAccount::initCredential (void)
 {
-    bool md5HashingEnabled = false;
-    int dataType = 0;
-    md5HashingEnabled = Manager::instance().preferences.getMd5Hash();
+    // We want to make sure that the password is really
+    // 32 characters long. Otherwise, pjsip will fail
+    // on an assertion.
+    bool md5HashingEnabled = Manager::instance().preferences.getMd5Hash()
+                             && _password.length() == 32;
+    int dataType = md5HashingEnabled ? PJSIP_CRED_DATA_DIGEST 
+                                     : PJSIP_CRED_DATA_PLAIN_PASSWD;
     std::string digest;
 
     // Create the credential array
-    pjsip_cred_info * cred_info = (pjsip_cred_info *) malloc (sizeof (pjsip_cred_info) * (getCredentialCount()));
+    pjsip_cred_info *cred_info = (pjsip_cred_info *)
+            calloc(getCredentialCount(), sizeof (pjsip_cred_info));
 
-    if (cred_info == NULL) {
+    if (!cred_info) {
         _error ("SipAccount: Error: Failed to set cred_info for account %s", _accountID.c_str());
-        return 1;
+        return;
     }
 
-    pj_bzero (cred_info, sizeof (pjsip_cred_info) * getCredentialCount());
+    if (md5HashingEnabled )
+        _debug ("Setting digest ");
 
     // Use authentication username if provided
     if (!_authenticationUsername.empty())
@@ -820,56 +821,28 @@ int SIPAccount::initCredential (void)
     // Set realm for that credential. * by default.
     cred_info[0].realm = pj_str (strdup (_realm.c_str()));
 
-    // We want to make sure that the password is really
-    // 32 characters long. Otherwise, pjsip will fail
-    // on an assertion.
-    if (md5HashingEnabled && _password.length() == 32) {
-        dataType = PJSIP_CRED_DATA_DIGEST;
-        _debug ("Setting digest ");
-    } else {
-        dataType = PJSIP_CRED_DATA_PLAIN_PASSWD;
-    }
-
-    // Set the datatype
     cred_info[0].data_type = dataType;
-
-    // Set the secheme
     cred_info[0].scheme = pj_str ( (char*) "digest");
 
-    int i;
+#if 0 // FIXME, unused. see https://projects.savoirfairelinux.com/issues/6408
+    unsigned i;
 
     // Default credential already initialized, use credentials.getCredentialCount()
     for (i = 0; i < credentials.getCredentialCount(); i++) {
 
-        std::string username = _username;
-        std::string password = _password;
-        std::string realm = _realm;
-
-        cred_info[i].username = pj_str (strdup (username.c_str()));
-        cred_info[i].data = pj_str (strdup (password.c_str()));
-        cred_info[i].realm = pj_str (strdup (realm.c_str()));
-
-        // We want to make sure that the password is really
-        // 32 characters long. Otherwise, pjsip will fail
-        // on an assertion.
-
-        if (md5HashingEnabled && _password.length() == 32) {
-            dataType = PJSIP_CRED_DATA_DIGEST;
-            _debug ("Setting digest ");
-        } else {
-            dataType = PJSIP_CRED_DATA_PLAIN_PASSWD;
-        }
+        cred_info[i].username = pj_str (strdup (_username.c_str()));
+        cred_info[i].data = pj_str (strdup (_password.c_str()));
+        cred_info[i].realm = pj_str (strdup (_realm.c_str()));
 
         cred_info[i].data_type = dataType;
 
         cred_info[i].scheme = pj_str ( (char*) "digest");
 
-        _debug ("Setting credential %d realm = %s passwd = %s username = %s data_type = %d", i, realm.c_str(), password.c_str(), username.c_str(), cred_info[i].data_type);
+        _debug ("Setting credential %u realm = %s passwd = %s username = %s data_type = %d", i, _realm.c_str(), _password.c_str(), _username.c_str(), cred_info[i].data_type);
     }
+#endif
 
     _cred = cred_info;
-
-    return 0;
 }
 
 
@@ -884,7 +857,7 @@ int SIPAccount::registerVoIPLink()
 
     // Init TLS settings if the user wants to use TLS
     if (_tlsEnable == "true") {
-        _debug ("SIPAccount: TLS is ennabled for accounr %s", getAccountID().c_str());
+        _debug ("SIPAccount: TLS is enabled for account %s", getAccountID().c_str());
         _transportType = PJSIP_TRANSPORT_TLS;
         initTlsConfiguration();
     }
@@ -898,8 +871,7 @@ int SIPAccount::registerVoIPLink()
     }
 
     try {
-        // In our definition of the
-        // ip2ip profile (aka Direct IP Calls),
+        // In our definition of the ip2ip profile (aka Direct IP Calls),
         // no registration should be performed
         if (_accountID != IP2IP_PROFILE) {
             _link->sendRegister (_accountID);
@@ -928,49 +900,36 @@ int SIPAccount::unregisterVoIPLink()
     }
 
     return true;
-
 }
 
 pjsip_ssl_method SIPAccount::sslMethodStringToPjEnum (const std::string& method)
 {
-    if (method == "Default") {
+    if (method == "Default")
         return PJSIP_SSL_UNSPECIFIED_METHOD;
-    }
 
-    if (method == "TLSv1") {
+    if (method == "TLSv1")
         return PJSIP_TLSV1_METHOD;
-    }
 
-    if (method == "SSLv2") {
+    if (method == "SSLv2")
         return PJSIP_SSLV2_METHOD;
-    }
 
-    if (method == "SSLv3") {
+    if (method == "SSLv3")
         return PJSIP_SSLV3_METHOD;
-    }
 
-    if (method == "SSLv23") {
+    if (method == "SSLv23")
         return PJSIP_SSLV23_METHOD;
-    }
 
     return PJSIP_SSL_UNSPECIFIED_METHOD;
 }
 
 void SIPAccount::initTlsConfiguration (void)
 {
-    /*
-     * Initialize structure to zero
-     */
-    if (_tlsSetting) {
-        free (_tlsSetting);
-        _tlsSetting = NULL;
-    }
-
     // TLS listener is unique and should be only modified through IP2IP_PROFILE
 
     // setTlsListenerPort(atoi(tlsPortStr.c_str()));
     setTlsListenerPort (atoi (_tlsPortStr.c_str()));
 
+    free (_tlsSetting);
     _tlsSetting = (pjsip_tls_setting *) malloc (sizeof (pjsip_tls_setting));
 
     assert (_tlsSetting);
@@ -985,13 +944,12 @@ void SIPAccount::initTlsConfiguration (void)
     pj_cstr (&_tlsSetting->ciphers, _tlsCiphers.c_str());
     pj_cstr (&_tlsSetting->server_name, _tlsServerName.c_str());
 
-    _tlsSetting->verify_server = (_tlsVerifyServer == true) ? PJ_TRUE: PJ_FALSE;
-    _tlsSetting->verify_client = (_tlsVerifyClient == true) ? PJ_TRUE: PJ_FALSE;
-    _tlsSetting->require_client_cert = (_tlsRequireClientCertificate == true) ? PJ_TRUE: PJ_FALSE;
+    _tlsSetting->verify_server = _tlsVerifyServer ? PJ_TRUE: PJ_FALSE;
+    _tlsSetting->verify_client = _tlsVerifyClient ? PJ_TRUE: PJ_FALSE;
+    _tlsSetting->require_client_cert = _tlsRequireClientCertificate ? PJ_TRUE: PJ_FALSE;
 
     _tlsSetting->timeout.sec = atol (_tlsNegotiationTimeoutSec.c_str());
     _tlsSetting->timeout.msec = atol (_tlsNegotiationTimeoutMsec.c_str());
-
 }
 
 void SIPAccount::initStunConfiguration (void)
@@ -1233,4 +1191,3 @@ std::string SIPAccount::getContactHeader (const std::string& address, const std:
 
     return std::string (contact, len);
 }
-
diff --git a/sflphone-common/src/sip/sipaccount.h b/sflphone-common/src/sip/sipaccount.h
index 4e9cf88e697f46613fc9152da9f4769e463a561b..a798ab0371d5765d54476dac5f628839e4c4bfee 100644
--- a/sflphone-common/src/sip/sipaccount.h
+++ b/sflphone-common/src/sip/sipaccount.h
@@ -143,21 +143,21 @@ class Credentials : public Serializable
 
         virtual void unserialize (Conf::MappingNode *map);
 
-        int getCredentialCount (void) const {
+        unsigned getCredentialCount (void) const {
             return credentialCount;
         }
-        void setCredentialCount (int count) {
+        void setCredentialCount (unsigned count) {
             credentialCount = count;
         }
 
         void setNewCredential (const std::string &username,
                                const std::string &password,
                                const std::string &realm);
-        const CredentialItem *getCredential (int index) const;
+        const CredentialItem *getCredential (unsigned index) const;
 
     private:
 
-        int credentialCount;
+        unsigned credentialCount;
 
         CredentialItem credentialArray[10];
 
@@ -308,10 +308,10 @@ class SIPAccount : public Account
          * @param none
          * @return int The number of credentials set for this account.
          */
-        int getCredentialCount (void) const {
+        unsigned getCredentialCount (void) const {
             return credentials.getCredentialCount() + 1;
         }
-        void setCredentialCount (int count) {
+        void setCredentialCount (unsigned count) {
             return credentials.setCredentialCount (count);
         }
 
@@ -731,7 +731,7 @@ class SIPAccount : public Account
         /*
          * Initializes set of additional credentials, if supplied by the user.
          */
-        int initCredential (void);
+        void initCredential (void);
 
         /**
          * If username is not provided, as it happens for Direct ip calls,
diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp
index 01b3f1950f2f3a373a7f5bfc718f13e1017de738..55042c1a1f04d792d8aba2a6d41623b3c43e7de6 100644
--- a/sflphone-common/src/sip/sipvoiplink.cpp
+++ b/sflphone-common/src/sip/sipvoiplink.cpp
@@ -535,8 +535,8 @@ void SIPVoIPLink::sendRegister (AccountID id) throw(VoipLinkException)
     }
 
     pjsip_cred_info *cred = account->getCredInfo();
-    int credential_count = account->getCredentialCount();
-    _debug ("UserAgent: setting %d credentials in sendRegister", credential_count);
+    unsigned credential_count = account->getCredentialCount();
+    _debug ("UserAgent: setting %u credentials in sendRegister", credential_count);
     pjsip_regc_set_credentials (regc, credential_count, cred);
 
     // Add User-Agent Header