Remove Opaque object on failure to add to EPOLL

delete shouldn't have been used.
This commit is contained in:
Fred Nicolson 2018-11-28 21:51:22 +00:00 committed by GitHub
parent 094c211f7f
commit 8ee8e264b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,7 @@ namespace fr
if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, descriptor, &event) < 0) if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, descriptor, &event) < 0)
{ {
delete (Opaque*)event.data.ptr; added_sockets.erase(added_iter.first);
throw std::runtime_error("Failed to add socket: " + std::to_string(errno)); throw std::runtime_error("Failed to add socket: " + std::to_string(errno));
} }
} }
@ -96,4 +96,4 @@ namespace fr
#endif #endif
} }
//Windows implementation coming soon(tm) //Windows implementation coming soon(tm)