I extended the above code a bit: 
#include <stdio.h>
#include <stdlib.h>
void main()
{
  int temp = 0;
  int *ptr = &temp;
  printf("Before: %0X\n", ptr);
  free(ptr);
  printf("After: %0X\n", ptr);
  getchar();
}
If this code is compiled by Visual Studio 2010, in Debug configuration, calling free initiates a "Debug Assertion failed" message. This error message comes from dbgheap.c:
/*
 * If this ASSERT fails, a bad pointer has been passed in. It may be
 * totally bogus, or it may have been allocated from another heap.
 * The pointer MUST come from the 'local' heap.
 */
_ASSERTE(_CrtIsValidHeapPointer(pUserData));
Compiling with MinGW-GCC, the resulting exe runs without error (the "After: ..." line shows the same value for ptr as the "Before: ..." line).