Address cppcheck 2.5 warnings (#1720)

This slightly simplifies memory management.
This commit is contained in:
Andrew Gaul 2021-07-14 22:18:09 +09:00 committed by GitHub
parent 945cc2ac54
commit 7890989cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -2284,7 +2284,7 @@ int S3fsCurl::RequestPerform(bool dontAddAuthHeaders /*=false*/)
}
LastResponseCode = S3FSCURL_RESPONSECODE_NOTSET;
long responseCode;
long responseCode = S3FSCURL_RESPONSECODE_NOTSET;
int result = S3FSCURL_PERFORM_RESULT_NOTSET;
// 1 attempt + retries...

View File

@ -34,23 +34,20 @@ MVNODE *create_mvnode(const char *old_path, const char *new_path, bool is_dir, b
char *p_old_path;
char *p_new_path;
p = new MVNODE();
if(NULL == (p_old_path = strdup(old_path))){
delete p;
printf("create_mvnode: could not allocation memory for p_old_path\n");
S3FS_FUSE_EXIT();
return NULL;
}
if(NULL == (p_new_path = strdup(new_path))){
delete p;
free(p_old_path);
printf("create_mvnode: could not allocation memory for p_new_path\n");
S3FS_FUSE_EXIT();
return NULL;
}
p = new MVNODE();
p->old_path = p_old_path;
p->new_path = p_new_path;
p->is_dir = is_dir;