fix(cos/etags): initialize etags to NULL

This commit is contained in:
Minglei Jin 2023-11-20 11:38:48 +08:00
parent 7d23eb1350
commit ec9c2bde69
1 changed files with 5 additions and 1 deletions

View File

@ -537,7 +537,7 @@ int32_t s3PutObjectFromFile2(const char *file, const char *object) {
S3MultipartCommitHandler commit_handler = { S3MultipartCommitHandler commit_handler = {
{&responsePropertiesCallbackNull, &responseCompleteCallback}, &multipartPutXmlCallback, 0}; {&responsePropertiesCallbackNull, &responseCompleteCallback}, &multipartPutXmlCallback, 0};
manager.etags = (char **)taosMemoryMalloc(sizeof(char *) * totalSeq); manager.etags = (char **)taosMemoryCalloc(totalSeq, sizeof(char *));
manager.next_etags_pos = 0; manager.next_etags_pos = 0;
/* /*
if (uploadId) { if (uploadId) {
@ -597,6 +597,10 @@ int32_t s3PutObjectFromFile2(const char *file, const char *object) {
char buf[256]; char buf[256];
int n; int n;
for (i = 0; i < totalSeq; i++) { for (i = 0; i < totalSeq; i++) {
if (!manager.etags[i]) {
code = TAOS_SYSTEM_ERROR(EIO);
goto clean;
}
n = snprintf(buf, sizeof(buf), n = snprintf(buf, sizeof(buf),
"<Part><PartNumber>%d</PartNumber>" "<Part><PartNumber>%d</PartNumber>"
"<ETag>%s</ETag></Part>", "<ETag>%s</ETag></Part>",