How do I get rid of a memory leak in my C++ code? So I have this code which is supposed to read an input from a user and based on it create a graph: