free() does not set the pointer to NULL, so after you call free(first_lista_cont), first_lista_cont still points to the same memory address, but it's invalid. You'll have to set it to NULL yourself after calling free() on it for your while() condition to make sense.
EDIT: Here's a little program that illustrates what I'm saying:
Code:
itsme@itsme:~/C$ cat free.c
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
void *ptr;
printf("ptr points to %p\n", ptr);
ptr = malloc(1);
printf("ptr points to %p\n", ptr);
free(ptr);
printf("ptr points to %p\n", ptr);
return 0;
}
Code:
itsme@itsme:~/C$ ./free
ptr points to 0xb8000900
ptr points to 0x804a050
ptr points to 0x804a050
itsme@itsme:~/C$