realloc(): invalid next size when reallocating to make space for strcat on char *

This error occurs because some other part of your code has corrupted the heap. We can’t tell you what that error is without seeing the rest of the code.

The fact that FINE 7 is not printed tells you that realloc is failing. And that failure must be because buffer is invalid due to a heap corruption earlier in the execution.


Orthogonal to your actual problem, sizeof(char) is 1 by definition so it makes sense to remove it from the code.

Leave a Comment