Skip to content

Commit

Permalink
cloudfs_connect: properly release lock before exit.
Browse files Browse the repository at this point in the history
Fixes #161.
  • Loading branch information
TurboGit committed Sep 7, 2021
1 parent 48508fc commit 788b9db
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions cloudfsapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1661,9 +1661,9 @@ int cloudfs_connect()
json_object* o;

if (!safe_json_string(json_obj, access_token, "access_token"))
return 0;
goto error;
if (!safe_json_string(json_obj, token_type, "token_type"))
return 0;
goto error;

found = json_object_object_get_ex(json_obj, "expires_in", &o);
expire_sec = json_object_get_int(o);
Expand Down Expand Up @@ -1692,11 +1692,11 @@ int cloudfs_connect()
free(json_str);

if (!safe_json_string(json_obj, token, "token"))
return 0;
goto error;
if (!safe_json_string(json_obj, endpoint, "endpoint"))
return 0;
goto error;
if (!safe_json_string(json_obj, expires, "expires"))
return 0;
goto error;

/* set the global storage_url and storage_token, the only parameters needed for swift */
strcpy (storage_url, endpoint);
Expand All @@ -1706,4 +1706,8 @@ int cloudfs_connect()
pthread_mutex_unlock(&pool_mut);
return (response >= 200 && response < 300 && storage_token[0]
&& storage_url[0]);

error:
pthread_mutex_unlock(&pool_mut);
return 0;
}

0 comments on commit 788b9db

Please sign in to comment.