Fixed some minor issues found during code review.

This commit is contained in:
Jan Vidar Krey 2010-05-25 22:47:30 +02:00
parent 473ff0e159
commit 77faac0494
3 changed files with 14 additions and 10 deletions

View File

@ -257,9 +257,15 @@ int hub_handle_chat_message(struct hub_info* hub, struct hub_user* u, struct adc
int relay = 1;
int offset;
if (!message || !user_is_logged_in(u))
if (!message)
return 0;
if (!user_is_logged_in(u))
{
hub_free(message);
return 0;
}
if ((cmd->cache[0] == 'B') && (message[0] == '!' || message[0] == '+'))
{
/*
@ -480,11 +486,11 @@ void hub_send_flood_warning(struct hub_info* hub, struct hub_user* u, const char
adc_msg_add_argument(msg, "110");
adc_msg_add_argument(msg, tmp);
hub_free(tmp);
}
route_to_user(hub, u, msg);
user_flag_set(u, flag_flood);
adc_msg_free(msg);
route_to_user(hub, u, msg);
user_flag_set(u, flag_flood);
adc_msg_free(msg);
}
}
static void hub_event_dispatcher(void* callback_data, struct event_data* message)

View File

@ -92,9 +92,10 @@ static void probe_net_event(struct net_connection* con, int events, void *arg)
net_con_ssl_handshake(con, net_con_ssl_mode_server, probe->hub->ssl_ctx);
return;
}
#endif
#else
probe_destroy(probe);
return;
#endif
}
}
}

View File

@ -79,11 +79,8 @@ int net_backend_init()
timeout_queue_initialize(&g_backend->timeout_queue, g_backend->now, 120); /* FIXME: max 120 secs! */
g_backend->cleaner = net_cleanup_initialize(g_backend->common.max);
for (n = 0; n < sizeof(net_backend_init_funcs); n++)
for (n = 0; net_backend_init_funcs[n]; n++)
{
if (!net_backend_init_funcs[n])
break;
g_backend->data = net_backend_init_funcs[n](&g_backend->handler, &g_backend->common);
if (g_backend->data)
{