malloc is complaining that you have corrupted a pointer in some way example:
Code:
char *ptr=malloc(100);
char tmp[10={0x0};
..........
.......
ptr++;
............
..........
free(ptr);
The error happens on a realloc or a free because the pointer no longer references the same start of memory. You can get the same result by writing, say, 15 characters into the tmp string, so that you overwrote the string and changed the memory value stored in ptr.