multi: on socket callback error, remove socket hash entry nonetheless

Previously an error from the callback accidentally made libcurl keep the
hash entry which would lead to the entry remaining and then potentially
getting removed *again* which would lead to internal confusions.

This is an old issue (introduced in 2b3dd01b77), caught by the new
asserts from c0233a35da.

Closes #14557
This commit is contained in:
Daniel Stenberg 2024-08-15 11:06:38 +02:00
parent ef1d606d1b
commit 160f023359
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -3013,17 +3013,20 @@ CURLMcode Curl_multi_pollset_ev(struct Curl_multi *multi,
if(oldactions & CURL_POLL_IN)
entry->readers--;
if(!entry->users) {
bool dead = FALSE;
if(multi->socket_cb) {
set_in_callback(multi, TRUE);
rc = multi->socket_cb(data, s, CURL_POLL_REMOVE,
multi->socket_userp, entry->socketp);
set_in_callback(multi, FALSE);
if(rc == -1) {
multi->dead = TRUE;
return CURLM_ABORTED_BY_CALLBACK;
}
if(rc == -1)
dead = TRUE;
}
sh_delentry(entry, &multi->sockhash, s);
if(dead) {
multi->dead = TRUE;
return CURLM_ABORTED_BY_CALLBACK;
}
}
else {
/* still users, but remove this handle as a user of this socket */