HeapFree(GetProcessHeap(),0,buffer).

How to fix this???