Merge pull request #1329 from gaul/cppcheck-2.1

Fix NULL pointer deference
This commit is contained in:
Takeshi Nakatani 2020-07-09 23:00:36 +09:00 committed by GitHub
commit 3f6b5ae6a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4397,9 +4397,9 @@ int S3fsMultiCurl::MultiPerform()
for(s3fscurllist_t::iterator iter = clist_req.begin(); iter != clist_req.end(); ++iter) {
pthread_t thread;
S3fsCurl* s3fscurl = *iter;
s3fscurl->sem = &sem;
s3fscurl->completed_tids_lock = &completed_tids_lock;
s3fscurl->completed_tids = &completed_tids;
if(!s3fscurl){
continue;
}
sem.wait();
@ -4421,6 +4421,9 @@ int S3fsMultiCurl::MultiPerform()
}
completed_tids.clear();
}
s3fscurl->sem = &sem;
s3fscurl->completed_tids_lock = &completed_tids_lock;
s3fscurl->completed_tids = &completed_tids;
isMultiHead |= s3fscurl->GetOp() == "HEAD";
@ -4590,7 +4593,10 @@ void* S3fsMultiCurl::RequestPerformWrapper(void* arg)
{
S3fsCurl* s3fscurl= static_cast<S3fsCurl*>(arg);
void* result = NULL;
if(s3fscurl && s3fscurl->fpLazySetup){
if(!s3fscurl){
return (void*)(intptr_t)(-EIO);
}
if(s3fscurl->fpLazySetup){
if(!s3fscurl->fpLazySetup(s3fscurl)){
S3FS_PRN_ERR("Failed to lazy setup, then respond EIO.");
result = (void*)(intptr_t)(-EIO);