Do not use malloc/realloc/calloc/free in a C++ program.
Not an issue, methinks.
You're allocating arrays of length 1 byte and indexing past the end of that 1 byte array.
You are trying to create a robust solution to getting variable-length input with C-strings. You should use a function for that. Here's a simple one I wrote a while ago to demonstrate the tricky issues for doing that: http://www.cplusplus.com/forum/beginner/4174/#msg18271