Commit a9572bf8 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

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

and there are not lock/unlock functions set!
parent 5a93f503
Loading
Loading
Loading
Loading
+18 −15
Original line number Diff line number Diff line
@@ -158,10 +158,12 @@ curl_share_cleanup(CURLSH *sh)
  if (share == NULL)
    return CURLSHE_INVALID;

  if(share->lockfunc)
    share->lockfunc(NULL, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE,
                    share->clientdata);

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

  if(share->unlockfunc)
    share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata);
  free(share);