Skip to content

Commit

Permalink
fix potential leak in OC's wrapped_fd move assignment op
Browse files Browse the repository at this point in the history
  • Loading branch information
spoonincode committed Mar 17, 2020
1 parent 768c8f7 commit c05acf8
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class wrapped_fd {
wrapped_fd& operator=(const wrapped_fd&) = delete;
wrapped_fd(wrapped_fd&& other) : _inuse(other._inuse), _fd(other._fd) {other._inuse = false;}
wrapped_fd& operator=(wrapped_fd&& other) {
if(_inuse)
close(_fd);
_inuse = other._inuse;
_fd = other._fd;
other._inuse = false;
Expand Down

0 comments on commit c05acf8

Please sign in to comment.