avoid mem leak

This commit is contained in:
yihaoDeng 2023-06-02 04:08:08 +00:00
parent becc5c51a4
commit 63d9a5dcf3
1 changed files with 4 additions and 1 deletions

View File

@ -16,12 +16,12 @@
#include "tstreamFileState.h" #include "tstreamFileState.h"
#include "query.h" #include "query.h"
#include "storageapi.h"
#include "streamBackendRocksdb.h" #include "streamBackendRocksdb.h"
#include "taos.h" #include "taos.h"
#include "tcommon.h" #include "tcommon.h"
#include "thash.h" #include "thash.h"
#include "tsimplehash.h" #include "tsimplehash.h"
#include "storageapi.h"
#define FLUSH_RATIO 0.5 #define FLUSH_RATIO 0.5
#define FLUSH_NUM 4 #define FLUSH_NUM 4
@ -420,6 +420,7 @@ int32_t deleteExpiredCheckPoint(SStreamFileState* pFileState, TSKEY mark) {
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
sscanf(val, "%" PRId64 "", &maxCheckPointId); sscanf(val, "%" PRId64 "", &maxCheckPointId);
taosMemoryFree(val);
} }
for (int64_t i = maxCheckPointId; i > 0; i--) { for (int64_t i = maxCheckPointId; i > 0; i--) {
char buf[128] = {0}; char buf[128] = {0};
@ -435,9 +436,11 @@ int32_t deleteExpiredCheckPoint(SStreamFileState* pFileState, TSKEY mark) {
if (ts < mark) { if (ts < mark) {
// statekey winkey.ts < mark // statekey winkey.ts < mark
forceRemoveCheckpoint(pFileState, i); forceRemoveCheckpoint(pFileState, i);
taosMemoryFreeClear(val);
break; break;
} else { } else {
} }
taosMemoryFree(val);
} }
return code; return code;
} }