1
0
mirror of https://github.com/moparisthebest/curl synced 2025-01-03 09:58:02 -05:00

Andr�s Garc�a found out the share cleanup code crashes when you cleanup

and there are not lock/unlock functions set!
This commit is contained in:
Daniel Stenberg 2004-07-02 08:28:31 +00:00
parent 5a93f50394
commit a9572bf88a

View File

@ -158,10 +158,12 @@ curl_share_cleanup(CURLSH *sh)
if (share == NULL) if (share == NULL)
return CURLSHE_INVALID; return CURLSHE_INVALID;
if(share->lockfunc)
share->lockfunc(NULL, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE, share->lockfunc(NULL, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE,
share->clientdata); share->clientdata);
if (share->dirty) { if (share->dirty) {
if(share->unlockfunc)
share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata); share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata);
return CURLSHE_IN_USE; return CURLSHE_IN_USE;
} }
@ -174,6 +176,7 @@ curl_share_cleanup(CURLSH *sh)
Curl_cookie_cleanup(share->cookies); Curl_cookie_cleanup(share->cookies);
#endif /* CURL_DISABLE_HTTP */ #endif /* CURL_DISABLE_HTTP */
if(share->unlockfunc)
share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata); share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata);
free(share); free(share);