Fix various issues reported by Coverity

This commit is contained in:
Přemysl Eric Janouch 2015-07-11 14:47:45 +02:00
parent c3d39dab5b
commit 5692da47be
3 changed files with 12 additions and 6 deletions

View File

@ -5003,7 +5003,10 @@ irc_handle_nick (struct server *s, const struct irc_message *msg)
user_unref (buffer_collision->user);
buffer_collision->user = user_ref (user);
}
if (pm_buffer && buffer_collision)
{
// There's not much else we can do other than somehow try to merge
// one buffer into the other. In our case, the original buffer wins.
buffer_merge (s->ctx, buffer_collision, pm_buffer);
@ -6265,7 +6268,7 @@ static void
config_dump_children
(struct config_item_ *object, struct config_dump_data *data)
{
hard_assert (object->type = CONFIG_ITEM_OBJECT);
hard_assert (object->type == CONFIG_ITEM_OBJECT);
struct config_dump_level level;
level.next = NULL;
@ -7788,6 +7791,7 @@ process_user_command
struct command_handler *handler;
if (!(handler = str_map_find (&map, command_name)))
return false;
hard_assert (handler->flags == 0 || (handler->flags & HANDLER_SERVER));
if ((handler->flags & HANDLER_SERVER)
&& args.buffer->type == BUFFER_GLOBAL)
@ -8036,7 +8040,7 @@ static size_t
utf8_common_prefix (const char **vector, size_t len)
{
size_t prefix = 0;
if (!vector || !vector[0])
if (!vector || !len)
return 0;
struct utf8_iter a[len];

5
kike.c
View File

@ -1818,8 +1818,11 @@ mode_processor_do_list (struct mode_processor *self,
return;
}
if (!mode_processor_check_operator (self))
return;
char *mask = irc_check_expand_user_mask (target);
if (!mode_processor_check_operator (self) || !mask)
if (!mask)
return;
size_t i;

View File

@ -673,13 +673,12 @@ prepare_recovery_environment (void)
break;
}
if (iter)
if (*iter)
g_startup_reason_location = iter;
else
{
g_startup_reason_location = g_recovery_env.vector + g_recovery_env.len;
str_vector_add (&g_recovery_env, "");
g_startup_reason_location =
g_recovery_env.vector + g_recovery_env.len - 1;
}
}