Fix two Clang static analyzer issues

Overflowing memory allocations should crash or exit anyway.
This commit is contained in:
Přemysl Eric Janouch 2014-07-19 22:35:12 +02:00
parent 027333e56a
commit a87be6dfd2
2 changed files with 3 additions and 1 deletions

View File

@ -1072,6 +1072,8 @@ poller_ensure_space (struct poller *self)
return;
self->alloc <<= 1;
hard_assert (self->alloc != 0);
self->revents = xreallocarray
(self->revents, sizeof *self->revents, self->alloc);
self->info = xreallocarray

View File

@ -773,7 +773,7 @@ plugin_process_message (const struct irc_message *msg,
return;
const char *command = msg->params.vector[0];
if (!strcasecmp (command, "register"))
if (!plugin->initialized && !strcasecmp (command, "register"))
{
// Register for relaying of IRC traffic
plugin->initialized = true;