Fix some issues reported by scan-build.

All of these are harmless and should never cause an issue in practise.
This commit is contained in:
Sadie Powell 2023-01-15 22:28:45 +00:00
parent 9109587ed2
commit 769f9c0c34
5 changed files with 31 additions and 8 deletions

View File

@ -279,21 +279,27 @@ found_src:
// The modules registered for a hook are called in reverse order (to allow for easier removal
// of list entries while looping), meaning that the Priority given to us has the exact opposite effect
// on the list, e.g.: PRIORITY_BEFORE will actually put 'mod' after 'which', etc.
size_t swap_pos = my_pos;
size_t swap_pos;
switch (s)
{
case PRIORITY_LAST:
{
if (prioritizationState != PRIO_STATE_FIRST)
return true;
else
swap_pos = 0;
swap_pos = 0;
break;
}
case PRIORITY_FIRST:
{
if (prioritizationState != PRIO_STATE_FIRST)
return true;
else
swap_pos = EventHandlers[i].size() - 1;
swap_pos = EventHandlers[i].size() - 1;
break;
}
case PRIORITY_BEFORE:
{
/* Find the latest possible position, only searching AFTER our position */
@ -308,6 +314,7 @@ found_src:
// didn't find it - either not loaded or we're already after
return true;
}
/* Place this module before a set of other modules */
case PRIORITY_AFTER:
{
@ -322,6 +329,9 @@ found_src:
// didn't find it - either not loaded or we're already before
return true;
}
default:
return true; // Should never happen.
}
swap_now:

View File

@ -143,8 +143,7 @@ public:
}
else
{
m = new BlockedMessage(parameters[1], parameters[0], ServerInstance->Time());
blockamsg.Set(user, m);
blockamsg.SetFwd(user, parameters[1], parameters[0], ServerInstance->Time());
}
}
return MOD_RES_PASSTHRU;

View File

@ -138,7 +138,7 @@ public:
cloaks->push_back(cloak);
ServerInstance->Logs.Debug(MODNAME, "Cloaked %s (%s/%s) as %s using the %s method.",
user->uuid.c_str(), user->GetIPString().c_str(), user->GetRealHost().c_str(),
user->uuid.c_str(), user->GetIPString().c_str(), user->GetRealHost().c_str(),
cloak.c_str(), cloakmethod->GetName());
}
ext.Set(user, cloaks);

View File

@ -160,6 +160,13 @@ public:
list->push_back(dccallow);
}
// If we have an empty list then don't store it.
if (list->empty())
{
delete list;
return;
}
// The value was well formed.
Set(user, list);
}

View File

@ -247,6 +247,13 @@ public:
list->emplace(flags, mask);
}
// If we have an empty list then don't store it.
if (list->empty())
{
delete list;
return;
}
// The value was well formed.
Set(user, list);
}