cos/delete: fix delete object cond and double free

This commit is contained in:
Minglei Jin 2023-10-18 18:21:45 +08:00
parent f26ec41b8e
commit 52c8bc91f9
1 changed files with 2 additions and 2 deletions

View File

@ -644,7 +644,7 @@ static S3Status listBucketCallback(int isTruncated, const char *nextMarker, int
} }
static void s3FreeObjectKey(void *pItem) { static void s3FreeObjectKey(void *pItem) {
char *key = (char *)pItem; char *key = *(char **)pItem;
taosMemoryFree(key); taosMemoryFree(key);
} }
@ -682,7 +682,7 @@ void s3DeleteObjectsByPrefix(const char *prefix) {
} while (data.isTruncated && (!maxkeys || (data.keyCount < maxkeys))); } while (data.isTruncated && (!maxkeys || (data.keyCount < maxkeys)));
if (data.status == S3StatusOK) { if (data.status == S3StatusOK) {
if (!data.keyCount) { if (data.keyCount > 0) {
// printListBucketHeader(allDetails); // printListBucketHeader(allDetails);
s3DeleteObjects(TARRAY_DATA(data.objectArray), TARRAY_SIZE(data.objectArray)); s3DeleteObjects(TARRAY_DATA(data.objectArray), TARRAY_SIZE(data.objectArray));
} }