Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private auto_ptr field in classes without copy constructors or copy assignment operators. #59

Open
Snape3058 opened this issue May 22, 2019 · 0 comments

Comments

@Snape3058
Copy link

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:

class legacy_sync_pool : public application_specific_pool {

class mem_cache : public base_cache {

class event_loop_impl {

class date_format : public formatter<CharType> {

class date_format : public formatter<CharType> {

Hope these reports are useful to you. Please contact me if you have any questions.

Regares.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant