diff --git a/source/common/src/cos.c b/source/common/src/cos.c index b4e654c67a..1dca5eda9b 100644 --- a/source/common/src/cos.c +++ b/source/common/src/cos.c @@ -537,7 +537,7 @@ int32_t s3PutObjectFromFile2(const char *file, const char *object) { S3MultipartCommitHandler commit_handler = { {&responsePropertiesCallbackNull, &responseCompleteCallback}, &multipartPutXmlCallback, 0}; - manager.etags = (char **)taosMemoryMalloc(sizeof(char *) * totalSeq); + manager.etags = (char **)taosMemoryCalloc(totalSeq, sizeof(char *)); manager.next_etags_pos = 0; /* if (uploadId) { @@ -597,6 +597,10 @@ int32_t s3PutObjectFromFile2(const char *file, const char *object) { char buf[256]; int n; for (i = 0; i < totalSeq; i++) { + if (!manager.etags[i]) { + code = TAOS_SYSTEM_ERROR(EIO); + goto clean; + } n = snprintf(buf, sizeof(buf), "%d" "%s",