On the same issue. Deallocating the char array before returning because of error.