mirror of
https://github.com/znc/znc.git
synced 2026-08-05 16:33:46 +02:00
Fix a couple of issues pointed out by https://scan.coverity.com/
This commit is contained in:
+4
-13
@@ -1252,7 +1252,7 @@ bool CZNC::LoadUsers(CConfig& config, CString& sError) {
|
||||
|
||||
CUtils::PrintMessage("Loading user [" + sUserName + "]");
|
||||
|
||||
CUser* pUser = new CUser(sUserName);
|
||||
std::unique_ptr<CUser> pUser(new CUser(sUserName));
|
||||
|
||||
if (!m_sStatusPrefix.empty()) {
|
||||
if (!pUser->SetStatusPrefix(m_sStatusPrefix)) {
|
||||
@@ -1265,35 +1265,26 @@ bool CZNC::LoadUsers(CConfig& config, CString& sError) {
|
||||
|
||||
if (!pUser->ParseConfig(pSubConf, sError)) {
|
||||
CUtils::PrintError(sError);
|
||||
delete pUser;
|
||||
pUser = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!pSubConf->empty()) {
|
||||
sError = "Unhandled lines in config for User [" + sUserName + "]!";
|
||||
CUtils::PrintError(sError);
|
||||
|
||||
DumpConfig(pSubConf);
|
||||
return false;
|
||||
}
|
||||
|
||||
CString sErr;
|
||||
if (!AddUser(pUser, sErr, true)) {
|
||||
sError = "Invalid user [" + pUser->GetUserName() + "] " + sErr;
|
||||
if (!AddUser(pUser.release(), sErr, true)) {
|
||||
sError = "Invalid user [" + sUserName + "] " + sErr;
|
||||
}
|
||||
|
||||
if (!sError.empty()) {
|
||||
CUtils::PrintError(sError);
|
||||
if (pUser) {
|
||||
pUser->SetBeingDeleted(true);
|
||||
delete pUser;
|
||||
pUser = nullptr;
|
||||
}
|
||||
pUser->SetBeingDeleted(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
pUser = nullptr;
|
||||
}
|
||||
|
||||
if (m_msUsers.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user