initialize values prior to list_for_each() calls, to avoid static analysers complaints on garbage values.

This commit is contained in:
Nikos Mavrogiannopoulos
2013-12-06 14:50:48 +01:00
parent b90c160b01
commit d4a56c6a33
4 changed files with 12 additions and 12 deletions

View File

@@ -456,7 +456,7 @@ int handle_auth_req(main_server_st *s, struct proc_st* proc,
*/
int check_multiple_users(main_server_st *s, struct proc_st* proc)
{
struct proc_st *ctmp, *cpos;
struct proc_st *ctmp = NULL, *cpos;
unsigned int entries = 1; /* that one */
if (s->config->max_same_clients == 0)

View File

@@ -605,7 +605,7 @@ struct banned_st *btmp, *bpos;
void expire_banned(main_server_st* s)
{
time_t now = time(0);
struct banned_st *btmp, *bpos;
struct banned_st *btmp = NULL, *bpos;
if (s->config->min_reauth_time == 0)
return;

View File

@@ -296,7 +296,7 @@ static void cleanup_children(main_server_st *s)
{
int status, estatus, ret;
pid_t pid;
struct script_wait_st *stmp, *spos;
struct script_wait_st *stmp = NULL, *spos;
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
estatus = WEXITSTATUS(status);
@@ -420,10 +420,10 @@ static void drop_privileges(main_server_st* s)
*/
void clear_lists(main_server_st *s)
{
struct listener_st *ltmp, *lpos;
struct proc_st *ctmp, *cpos;
struct script_wait_st *script_tmp, *script_pos;
struct banned_st *btmp, *bpos;
struct listener_st *ltmp = NULL, *lpos;
struct proc_st *ctmp = NULL, *cpos;
struct script_wait_st *script_tmp = NULL, *script_pos;
struct banned_st *btmp = NULL, *bpos;
list_for_each_safe(&s->llist.head, ltmp, lpos, list) {
close(ltmp->fd);
@@ -459,7 +459,7 @@ void clear_lists(main_server_st *s)
static void kill_children(main_server_st* s)
{
struct proc_st *ctmp;
struct proc_st *ctmp = NULL;
/* kill the security module server */
kill(s->sec_mod_pid, SIGTERM);
@@ -493,7 +493,7 @@ static int forward_udp_to_owner(main_server_st* s, struct listener_st *listener)
{
int ret, e;
struct sockaddr_storage cli_addr;
struct proc_st *ctmp;
struct proc_st *ctmp = NULL;
socklen_t cli_addr_size;
uint8_t buffer[1024];
uint8_t *session_id;
@@ -629,8 +629,8 @@ static int check_tcp_wrapper(int fd)
int main(int argc, char** argv)
{
int fd, pid, e;
struct listener_st *ltmp;
struct proc_st *ctmp, *cpos;
struct listener_st *ltmp = NULL;
struct proc_st *ctmp = NULL, *cpos;
fd_set rd;
int val, n = 0, ret, flags;
struct timeval tv;

View File

@@ -41,7 +41,7 @@ struct script_wait_st *stmp;
inline static void remove_from_script_list(main_server_st* s, struct proc_st* proc)
{
struct script_wait_st *stmp, *spos;
struct script_wait_st *stmp = NULL, *spos;
list_for_each_safe(&s->script_list.head, stmp, spos, list) {
if (stmp->proc == proc) {