This is not a leak. It is undefined behavior here. You want a static code analyser.
There is free one in clang, there in cppcheck and I believe Visual studio has one too.
With some compilers you can enable bound checks for vector's operator[]. In GCC it will do bounds checking if you define the macro _GLIBCXX_DEBUG. I guess you can do something similar in Visual C++.