You can even do
#define free(p) do { free(p); p = NULL; } while(0)
And when you want to call the original free: (free)(p);
The preprocessor will not substitute this occurence of free.