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

chore: rule of 3 for strdup guard #3905

Merged
merged 2 commits into from
Apr 26, 2022

Conversation

Skylion007
Copy link
Collaborator

@Skylion007 Skylion007 commented Apr 26, 2022

Description

I noticed our strdup_guard wasn't properly following the rule of 5 and some of the implicit copy constructors / assignment operators could in theory cause a double free. This PR explicitly deletes the copy ctors to guard against accidents in future refactoring work.

Suggested changelog entry:

* Avoid potential implicit copy/assignment constructors causing double free in ``strdup_gaurd``.

@Skylion007 Skylion007 changed the title chore: rule of 5 for strdup guard chore: rule of 3 for strdup guard Apr 26, 2022
Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Skylion007 Skylion007 merged commit 75007dd into pybind:master Apr 26, 2022
@Skylion007 Skylion007 deleted the skylion007/rule-of-5-strdup branch April 26, 2022 19:49
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Apr 26, 2022
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Jul 7, 2022
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

Successfully merging this pull request may close these issues.

3 participants