Skip to content

Commit

Permalink
chore: rule of 3 for strdup guard (pybind#3905)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skylion007 authored Apr 26, 2022
1 parent 9bc2704 commit 75007dd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ class cpp_function : public function {
// along the way.
class strdup_guard {
public:
strdup_guard() = default;
strdup_guard(const strdup_guard &) = delete;
strdup_guard &operator=(const strdup_guard &) = delete;

~strdup_guard() {
for (auto *s : strings) {
std::free(s);
Expand Down

0 comments on commit 75007dd

Please sign in to comment.