Merge pull request #29276 from taosdata/fix/fixInvalidFreeMain

fix double free
This commit is contained in:
Shengliang Guan 2024-12-25 17:19:21 +08:00 committed by GitHub
commit 1c2b3947b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -106,6 +106,11 @@ TFileCache* tfileCacheCreate(SIndex* idx, const char* path) {
SArray* files = NULL;
int32_t code = tfileGetFileList(path, &files);
if (code != 0) {
indexError("failed to get file list since %s", tstrerror(code));
goto End;
}
for (size_t i = 0; i < taosArrayGetSize(files); i++) {
char* file = taosArrayGetP(files, i);
@ -1182,7 +1187,6 @@ _exception:
TAOS_UNUSED(taosCloseDir(&pDir));
if (files != NULL) {
taosArrayDestroyEx(files, tfileDestroyFileName);
taosArrayDestroy(files);
}
return code;
}