The vulnerability CVE-2025-0665 describes a double close of an eventfd file descriptor in libcurl when using a threaded name resolver. The provided commit ff5091aa9f73802e894b1cbdf directly addresses this issue. The patch modifies the function destroy_thread_sync_data in lib/asyn-thread.c.
The patch adds a preprocessor directive #ifndef USE_EVENTFD around the block of code that closes tsd->sock_pair[1]. This explicitly shows that the call wakeup_close(tsd->sock_pair[1]) within destroy_thread_sync_data was the source of the double close when USE_EVENTFD was enabled. The commit message for the fix states: "When employing eventfd for socketpair, there is only one file descriptor. Closing that fd twice might result in fd corruption. Thus, we should avoid closing the eventfd twice". This confirms that destroy_thread_sync_data was performing the erroneous second close. The advisory also mentions "the superfluous one was left accidentally used because of an #ifdef mistake", which aligns with the fix made in this function.