Realloc fail on union

Yeah. I don't even need to look at your code to know what's wrong. The essence of the problem is that those two things are mutually exclusive. You're using a union which makes you responsible for memory management; especially the poison pointer waiting in your Buffer.

But, like I said, I haven't looked at your code so I could be wrong.

You're trying to write a string library with Single Sign-on?

What is that?

Why are you doing that?