I'm just guessing here as you haven't provided much in the way of how those functions are used, but it looks like if you add a vertex, the AddVertex() function will be accessing beyond the end of the vertex array. You never extend it's size.
Would it be easier to use a std::vector<TVertex> and std::vector<ushort>? You can then query the size of the vector and ensure that vertexCount remains below that. Or you can just let them grow as needed.