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

Leak in boost::asio::detail::posix_event::posix_event() #406

Open
pdekeister opened this issue Feb 22, 2023 · 0 comments
Open

Leak in boost::asio::detail::posix_event::posix_event() #406

pdekeister opened this issue Feb 22, 2023 · 0 comments

Comments

@pdekeister
Copy link

Valgrind analysis gived

 8 bytes in 1 blocks are definitely lost in loss record 6 of 57
    at 0x4C287C4: malloc
    by 0xEA260D2: pthread_condattr_init 
    by 0x74459DE: boost::asio::detail::posix_event::posix_event() 
    by 0x74452BC: boost::asio::detail::scheduler::scheduler(boost::asio::execution_context&, int, bool) 
    by 0x9D3CE22: boost::asio::io_context::io_context() 

pthread_condattr_destroy is missing
I've made a patch seems to correct

--- boost/asio/detail/impl/posix_event.ipp.orig
+++ boost/asio/detail/impl/posix_event.ipp
@@ -45,6 +45,7 @@ posix_event::posix_event()
 #endif // (defined(__MACH__) && defined(__APPLE__))
        // || (defined(__ANDROID__) && (__ANDROID_API__ < 21))
 
+  ::pthread_condattr_destroy(&attr);
   boost::system::error_code ec(error,
       boost::asio::error::get_system_category());
   boost::asio::detail::throw_error(ec, "event");
@mclow mclow transferred this issue from boostorg/boost Feb 22, 2023
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