in addition to what 2kaud already wrote:

avoid using goto. It is very hard to maintain, to understand any logic with "goto" and it is very hard to debug.
avoid using malloc in C++ code. Use...