And when talking about C++, since 2011 there are smart pointers to help developers managing memory kind of automatically.
I believe most of the problems are due the people typing on those keyboards such bad code, especially when it comes to "smart" code.
In 2020 we have plenty of tools supporting the developer job (memory sanitizers, static analysis tools, linting, profilers, etc.): The big problem is failing to / ignoring to use such tools.