TurboGit / hubicfuse

Support for mounting HubiC drive in GNU/Linux
MIT License
327 stars 55 forks source link

An improper locking error due to the unreleased lock #161

Closed ycaibb closed 3 years ago

ycaibb commented 3 years ago

Hi, developers, thank you for your checking. It seems the lock pool_mut could be not released correctly in the function cloudfs_connect?

https://github.com/TurboGit/hubicfuse/blob/34a6c3e57467b5f7e9befe2171bf4292893c5a18/cloudfsapi.c#L1616

int cloudfs_connect()
{
 pthread_mutex_lock(&pool_mut); 
...;

  if (!safe_json_string(json_obj, access_token, "access_token"))
    return 0;  // lack unlock 
  if (!safe_json_string(json_obj, token_type, "token_type"))
    return 0; // lack unlock 

  ...;

  if (!safe_json_string(json_obj, token, "token"))
    return 0; // lack unlock 
  if (!safe_json_string(json_obj, endpoint, "endpoint"))
    return 0; // lack unlock 
  if (!safe_json_string(json_obj, expires, "expires"))
    return 0; // lack unlock 

 ...;
  pthread_mutex_unlock(&pool_mut);
  return (response >= 200 && response < 300 && storage_token[0]
          && storage_url[0]);
}

Best,

TurboGit commented 3 years ago

Indeed, thanks for reporting. Should be fixed now.