Freeing the Wrong Address
MemoryScape can detect when a program tries to free a block that does not correspond to the start of a block allocated using the malloc() function. The following program illustrates this problem:
int main (int argc, char *argv[])
{
char *s, *misaligned_s;
/* Get some memory */
s = malloc(sizeof(int)*64));
/* Release memory using a misaligned address */
misaligned_s = s + 8;
free(misaligned_s);
free(s);
return 0;
}