PREfast Warning 280 (Windows CE 5.0)
280 - Allocation/free mismatch.
Additional Information: <variable> is allocated with <function>, but deleted with <function> (see allocation at <location>).
This warning indicates that the calling function has inconsistently allocated memory with a function from one memory allocation family and freed it with a function from another memory allocation family.
For example, this warning would be produced if memory is allocated with malloc but freed with GlobalFree or delete. In the specific cases of mismatches between array and scalar variations of new and delete, PREfast reports the more precise warnings 278, 279, or 283.
Different API definitions can use different heaps (for example, GlobalAlloc uses the system heap, and free uses the C heap) and the allocation/free routines on Windows NT and later do not do validation of pointers/handles for performance reasons. This defect can result in memory corruptions and crashes.
Example
Defective Source
int *pInt= (int *)calloc(arraySize,
sizeof (int));
delete pInt;
Corrected Source
int *pInt= (int *)calloc(arraySize,
sizeof (int));
free(pInt);
Send Feedback on this topic to the authors