1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

multi interface: only use non-NULL function pointer!

If the socket callback function pointer hasn't been set, we must not
attempt to use it. Commit adc88ca20 made it more likely to occur.
This commit is contained in:
Daniel Stenberg 2011-12-02 21:10:28 +01:00
parent adc88ca203
commit d81f5ea3e0

View File

@ -1940,11 +1940,12 @@ static void singlesocket(struct Curl_multi *multi,
} }
/* we know (entry != NULL) at this point, see the logic above */ /* we know (entry != NULL) at this point, see the logic above */
multi->socket_cb(easy->easy_handle, if(multi->socket_cb)
s, multi->socket_cb(easy->easy_handle,
action, s,
multi->socket_userp, action,
entry->socketp); multi->socket_userp,
entry->socketp);
entry->action = action; /* store the current action state */ entry->action = action; /* store the current action state */
} }
@ -2019,11 +2020,12 @@ static void singlesocket(struct Curl_multi *multi,
remove_sock_from_hash = FALSE; remove_sock_from_hash = FALSE;
if(remove_sock_from_hash) { if(remove_sock_from_hash) {
multi->socket_cb(easy->easy_handle, if(multi->socket_cb)
s, multi->socket_cb(easy->easy_handle,
CURL_POLL_REMOVE, s,
multi->socket_userp, CURL_POLL_REMOVE,
entry ? entry->socketp : NULL); multi->socket_userp,
entry ? entry->socketp : NULL);
sh_delentry(multi->sockhash, s); sh_delentry(multi->sockhash, s);
} }