Bonsoir à tous,

J'ai un petit soucis avec le rapport de débogage de valgrind, a vrai dire je ne le comprend pas bien ...

Je vais commencer par vous mettre le rapport

==6458==
==6458== Conditional jump or move depends on uninitialised value(s)
==6458== at 0x804B12E: del_client (in /home/serveur/S-Inspire/sinspire)
==6458== by 0x804B17F: free_clients (in /home/serveur/S-Inspire/sinspire)
==6458== by 0x405B6E7: (within /lib/i686/cmov/libc-2.7.so)
==6458== by 0x804B56D: main (in /home/serveur/S-Inspire/sinspire)
==6458==
==6458== Invalid read of size 4
==6458== at 0x804B180: free_clients (in /home/serveur/S-Inspire/sinspire)
==6458== by 0x405B6E7: (within /lib/i686/cmov/libc-2.7.so)
==6458== by 0x804B56D: main (in /home/serveur/S-Inspire/sinspire)
==6458== Address 0x418f47c is 244 bytes inside a block of size 248 free'd
==6458== at 0x4022B8A: free (vg_replace_malloc.c:323)
==6458== by 0x804B17F: free_clients (in /home/serveur/S-Inspire/sinspire)
==6458== by 0x405B6E7: (within /lib/i686/cmov/libc-2.7.so)
==6458== by 0x804B56D: main (in /home/serveur/S-Inspire/sinspire)
ERROR: with function recv() [Resource temporarily unavailable]
==6458==
==6458== ERROR SUMMARY: 7 errors from 3 contexts (suppressed: 71 from 2)
==6458== malloc/free: in use at exit: 9,052 bytes in 38 blocks.
==6458== malloc/free: 45 allocs, 7 frees, 11,204 bytes allocated.
==6458== For counts of detected errors, rerun with: -v
==6458== searching for pointers to 38 not-freed blocks.
==6458== checked 87,632 bytes.
==6458==
==6458== LEAK SUMMARY:
==6458== definitely lost: 0 bytes in 0 blocks.
==6458== possibly lost: 0 bytes in 0 blocks.
==6458== still reachable: 9,052 bytes in 38 blocks.
==6458== suppressed: 0 bytes in 0 blocks.
==6458== Reachable blocks (those to which a pointer was found) are not shown.
==6458== To see them, rerun with: --leak-check=full --show-reachable=yes
et voici les parties qui semblent poser problème

dans le main
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
static void
sig_handler(int signum)
{
	switch (signum)
	{
		/* Interrupt */
		case SIGINT:
		/* Terminated */
		case SIGTERM:
			irc_send(":%s SQUIT %s :received SIGINT/SIGTERM - closing link", me.sid, me.name);
			me.socket.active = 0;
			remove(pid_file);
			free_clients(); // < ---- ICI ----
			//free_commands();
			//free_users();
			break;
		/* Hangup */
		case SIGHUP:
			fprintf(stderr, "SIGHUP - reload config file\n");
			break;
		default:
			/* log others signals */
			fprintf(stderr, "Received signal [%d] - %s", signum, sys_siglist[signum]);
			break;
	}
}
le fichier clients.c

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 
#include "infos.h"
 
 
static t_client *clientlist = NULL;
 
 
t_client
*add_client(const char *sid, const char *uid, const char *nick,
                   const char *user, const char *host, const char *signon)
{
	t_client *cptr = malloc(sizeof(*cptr));
 
	if (!cptr) return NULL;
 
	string_copy(cptr->sid, sid, SIDLEN);
	string_copy(cptr->uid, uid, UIDLEN);
	string_copy(cptr->nick, nick, NICKLEN);
	string_copy(cptr->user, user, USERLEN);
	string_copy(cptr->host, host, HOSTLEN);
 
	cptr->prev = NULL;
	cptr->next = clientlist;
 
	if (cptr->next)
		cptr->next->prev = cptr;
 
	clientlist = cptr;
	return cptr;
}
 
 
t_client
*find_client_uid(const char *uid)
{
	t_client *cptr = clientlist;
	for (; cptr && strcasecmp(cptr->uid, uid); cptr = cptr->next);
	return cptr;
}
 
 
t_client
*find_client_nick(const char *nick)
{
	t_client *cptr = clientlist;
	for (; cptr && strcasecmp(cptr->nick, nick); cptr = cptr->next);
	return cptr;
}
 
 
void
del_client(t_client *cptr)
{
	if (cptr)
	{
		//if (do_debug) printf("free client %s [%p]\n", cptr->nick, cptr);
 
		if (cptr->prev)
			cptr->prev->next = cptr->next;
		else clientlist = cptr->next;
 
		if (cptr->next)
			cptr->next->prev = cptr->prev;
 
        if (cptr->access) /* remove authentification */
        	cptr->access = NULL;
 
		free(cptr);
	}
}
 
 
void
free_clients(void)
{
	t_client *cptr = clientlist;
 
	for (; cptr; cptr = cptr->next) del_client(cptr);
}
 
 
int
authorized(t_client *cptr, const char *comname)
{
	t_command *cmptr = find_command(comname);
 
	if (cptr->access)
	{
		if (cptr->access->level >= cmptr->level) return 1;
	}
	return 0;
}
et la structure client
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
/********************************************************************
 * Clients struct
 ********************************************************************/
struct s_client
{
	char sid[SIDLEN+1];
	char uid[UIDLEN+1];
	char nick[NICKLEN+1];
	char user[USERLEN+1];
	char host[HOSTLEN+1];
	char name[REALLEN+1];
	unsigned int modes;
#define UMODE_i 0x0001 /* User cannot be seen in /WHO by non-IRC Ops */
#define UMODE_w 0x0002 /* User can receive WALLOPS */
#define UMODE_x 0x0004 /* Masks a users hostname. Disallows others from getting your IP address. */
#define UMODE_o 0x0008 /* User is an IRC Operator */
#define UMODE_s 0x0010 /* User can receive server notices. */
#define UMODE_B 0x0020 /* Marks the user as a Bot. */
#define UMODE_R 0x0040 /* User can only receive PRIVMSGs from registered (+r) users. */
#define UMODE_r 0x0080 /* Marks a user as "registered and identified" from Services. */
	time_t signon;
 
	t_user *access;
	t_client *prev, *next;
};
Il n'y a pas de plantage du programme mais les 7 erreurs qu'il me trouve me tracasse un peu.
Je sollicite une nouvelle fois votre aide ...

Merci à vous