diff --git a/src/curl.cpp b/src/curl.cpp
index 9720092..db1da48 100644
--- a/src/curl.cpp
+++ b/src/curl.cpp
@@ -3563,30 +3563,30 @@ int S3fsCurl::CompleteMultipartPostRequest(const char* tpath, const std::string&
}
// make contents
- std::string* pPostContent = new std::string();
- (*pPostContent) += "\n";
+ std::string postContent;
+ postContent += "\n";
int cnt = 0;
for(etaglist_t::iterator it = parts.begin(); it != parts.end(); ++it, ++cnt){
if(it->empty()){
S3FS_PRN_ERR("%d file part is not finished uploading.", cnt + 1);
- delete pPostContent;
return -EIO;
}
- (*pPostContent) += "\n";
- (*pPostContent) += " " + str(cnt + 1) + "\n";
- (*pPostContent) += " " + *it + "\n";
- (*pPostContent) += "\n";
+ postContent += "\n";
+ postContent += " " + str(cnt + 1) + "\n";
+ postContent += " " + *it + "\n";
+ postContent += "\n";
}
- (*pPostContent) += "\n";
+ postContent += "\n";
// set postdata
- postdata = reinterpret_cast(pPostContent->c_str());
+ postdata = reinterpret_cast(postContent.c_str());
b_postdata = postdata;
- postdata_remaining = pPostContent->size(); // without null
+ postdata_remaining = postContent.size(); // without null
b_postdata_remaining = postdata_remaining;
if(!CreateCurlHandle()){
- delete pPostContent;
+ postdata = NULL;
+ b_postdata = NULL;
return -EIO;
}
std::string resource;
@@ -3624,8 +3624,8 @@ int S3fsCurl::CompleteMultipartPostRequest(const char* tpath, const std::string&
// request
int result = RequestPerform();
bodydata.Clear();
- postdata = NULL;
- delete pPostContent;
+ postdata = NULL;
+ b_postdata = NULL;
return result;
}