TurboGit/hubicfuse

An improper locking due to the unreleased lock before program exit

Closed this issue · 1 comments

Hi developers, in the below codes, the lock pool_mut could be not released before program's exit abort();. I think there is no harm to write pthread_mutex_unlock(&pool_mut); before the abort(); for better resource management and code symmetry. Thanks!

hubicfuse/cloudfsapi.c

Lines 102 to 113 in 34a6c3e

static CURL* get_connection(const char* path)
{
pthread_mutex_lock(&pool_mut);
CURL* curl = curl_pool_count ? curl_pool[--curl_pool_count] : curl_easy_init();
if (!curl)
{
debugf(DBG_LEVEL_NORM, KRED"curl alloc failed");
abort();
}
pthread_mutex_unlock(&pool_mut);
return curl;
}

Indeed, should be fixed now. Thanks.