This code is 100% correct.
Check what sizeof(ENTITY) and sizeof(FLARE) is and see if its correct.
If nothing works simply use WinAPIs (CreateHeap, HeapAlloc, HeapFree)