When you free some memory using free(), the pointer does not get changed. It will still point to the exact same place in memory. It is up to you to manually set it to NULL. You are not doing this in your code above.
HOw can we check whether memory is allocated or not?
You can't (at least you use invariants of a class). However you need to know if the memory was allocated with malloc, calloc, realloc, to be freed with free.
1 2 3
int array[100];
int *ptr = array;
delete [] ptr; //error