Absolutely. free(p) will free the 12 bytes that were allocated by malloc(12). sganesh, wherever you got that idea from, it's complete nonsense.

Now if you do
Code:
int **p=malloc(12*sizeof(int*));
for (int i=0; i<12; i++)
  p[i]=malloc(12*sizeof(int));
(which creates a 2D array of 144 ints), THEN you will need a loop to free each of p[i] before you free p itself. Observe then that the malloc's exactly match the free's (there will be 13 of each). Every malloc must be matched by *exactly* one free for the application not to exhibit undefined behaviour.