Could someone help me with the following code?
void removeRepetidos(Lista *l)
{
Elemento *aux = (*l);
Elemento *aux2;
Elemento *aux3;
while(aux!=NULL)
{
aux2 = aux->prox;
while(aux2 != NULL)
{
if(aux->num == aux2->num)
{
aux2->ant->prox = aux2->prox;
if(aux2->prox!=NULL)
{
aux2->prox->ant = aux2->ant;
}
aux3 = aux2;
}
aux2 = aux2->prox;
free(aux3);
}
aux = aux->prox;
}
}
It is crashing when running, removing the deallocation function free()
the program works perfectly. I did not find any error in the logic of my code, I did several table tests.