bonjour, j'ai fais une fonction qui ajoute un élement a la fin
du tableau qui fonctionne mais qui me renvoie une erreur
direct après
void suppos(t_player *p, char *elem)
{
int i;
char **tab;
tab = p->player1;
i = 0;
if ((p->player1 = malloc(sizeof(char *) * tab_len(tab) + 1)) == NULL)
exit(-1);
while (i != tab_len(tab))
{
p->player1[i] = tab[i];
i++;
}
if (i == tab_len(tab))
p->player1[i] = elem;
p->player1[i + 1] = NULL;
}
j'ai sa comme erreur :
malloc.c:2365: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
Aborted