Repository navigation
Commit 1e12bd8
committed
[BUG] Keep an aborted session alive until its handle is freed
Handing the easy handle over untouched leaves CURLOPT_PRIVATE and the write,
header, read and progress callback data pointing at the session and its
operation. Clearing them was what made that safe before, and this branch
stopped clearing them on purpose, because the cancelling thread does not own
a handle the multi handle may still be driving.
The owner then has to outlive the handle, and on the abort path it did not.
ScheduleAbortSession takes the session out of sessions_, so doRemoveSessions
cannot find it to hold one, and doAbortSessions kept the only remaining
shared_ptr in a local map that died on return. The handle could reach
curl_multi_remove_handle and curl_easy_cleanup with those pointers dangling,
and curl_easy_cleanup is documented as able to run the progress and header
callbacks.
pending_to_remove_sessions_ already exists for this: doRemoveSessions swaps it
out and holds it until the handle is freed. The abort path hands the session
to it now.
26 tests pass, 3 of 3, and under AddressSanitizer with leak detection 2 of 2
with no leaks and no errors.
Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>1 parent 7f82d74 commit 1e12bd8
1 file changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
765 | 765 | | |
766 | 766 | | |
767 | 767 | | |
768 | | - | |
| 768 | + | |
769 | 769 | | |
770 | 770 | | |
771 | 771 | | |
| |||
777 | 777 | | |
778 | 778 | | |
779 | 779 | | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
780 | 789 | | |
781 | 790 | | |
782 | 791 | | |
| |||
0 commit comments