Private `auto_ptr` field in classes without copy constructors or copy assignment operators.
Opened this issue · 0 comments
I am now testing my new linter for checking smart pointer errors, and I have found something in your repo. Some of the classes declare a private auto_ptr
field without defining a copy constructor or a copy assignment operator, which will cause the auto_ptr
field becomes nullptr
when it is copied. And this may cause a null pointer dereference problem when using the field after the object has been copied.
One solution to this issue is to declare both the copy constructor and the copy assignment operator to be deleted to prevent their objects being copied. Just like what is implicitly done when using unique_ptr
.
I did not read all your code in your repo, but only reviewed the classes related to my reports. Therefore, I am not very sure whether my reports will really cause a crush. However, I think these reports worth being paid attention to.
Here are the reported classes:
cppcms/src/applications_pool.cpp
Line 399 in 270634e
Line 122 in 270634e
cppcms/booster/lib/aio/src/io_service.cpp
Line 114 in 270634e
Hope these reports are useful to you. Please contact me if you have any questions.
Regares.