diff --git a/src/client.cc b/src/client.cc index e72f6af3..e476195b 100644 --- a/src/client.cc +++ b/src/client.cc @@ -683,10 +683,16 @@ minio::s3::PutObjectResponse minio::s3::Client::PutObject(PutObjectArgs args) { "SSE operation must be performed over a secure connection"); } - std::vector buf(args.part_size + 1); + char* buf = NULL; + if (args.part_count > 0) { + buf = new char[args.part_size]; + } else { + buf = new char[args.part_size + 1]; + } std::string upload_id; - PutObjectResponse resp = PutObject(args, upload_id, (char*)&buf[0]); + PutObjectResponse resp = PutObject(args, upload_id, buf); + delete[] buf; if (!resp && !upload_id.empty()) { AbortMultipartUploadArgs amu_args;