Skip to content

curl_easy_cleanup without curl_multi_remove_handle can cause incorrect results in future operations #17578

@BrianHarris

Description

@BrianHarris

I did this

The documentation for curl_easy_cleanup does say:

To close an easy handle that has been used with the multi interface, make sure to first call curl_multi_remove_handle to remove it from the multi handle before it is closed.

However the code for curl_easy_cleanup automatically calls curl_multi_remove_handle, so this is normally not strictly required...

Except that curl_multi_remove_handle is called after Curl_detach_connection(data); which could leave the connection in a very bad state, leading to future operations on that connection receiving the data for the operation that was just cleaned up.

I believe this could be improved by moving the Curl_detach_connection(data); down below curl_multi_remove_handle . That note from the documentation could also be removed if this change is made.

I expected the following

No response

curl/libcurl version

libcurl 8.14.0

operating system

All

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions