DIT168-V2V-responsibles / v2v-protocol

GNU General Public License v3.0
7 stars 3 forks source link

Do not use raw pointers (new) #5

Closed chrberger closed 6 years ago

chrberger commented 6 years ago

The direct use of raw pointers created with new bear the risk of leaking memory. Thus, better create only wrapped pointers:

#include <memory>
shared_ptr<MyClass> ptrToMyClass = std::make_shared<MyClass>();
...

cf. http://en.cppreference.com/w/cpp/memory/shared_ptr/make_shared

maansthoernvik commented 6 years ago

This issue has been addressed in this commit.