Merge pull request #25798 from taosdata/fix/backendInvalidFree

Fix/backendInvalidFree
This commit is contained in:
wade zhang 2024-05-17 13:46:18 +08:00 committed by GitHub
commit b299ff0449
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -1588,7 +1588,7 @@ int32_t valueEncode(void* value, int32_t vlen, int64_t ttl, char** dest) {
if (*dest == NULL) { if (*dest == NULL) {
size_t size = sizeof(key.unixTimestamp) + sizeof(key.len) + sizeof(key.rawLen) + sizeof(key.compress) + key.len; size_t size = sizeof(key.unixTimestamp) + sizeof(key.len) + sizeof(key.rawLen) + sizeof(key.compress) + key.len;
char* p = taosMemoryCalloc(1, size); char* p = taosMemoryCalloc(1, size);
char* buf = p; char* buf = p;
len += taosEncodeFixedI64((void**)&buf, key.unixTimestamp); len += taosEncodeFixedI64((void**)&buf, key.unixTimestamp);
len += taosEncodeFixedI32((void**)&buf, key.len); len += taosEncodeFixedI32((void**)&buf, key.len);
len += taosEncodeFixedI32((void**)&buf, key.rawLen); len += taosEncodeFixedI32((void**)&buf, key.rawLen);
@ -2740,8 +2740,10 @@ int32_t streamStateGetGroupKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey,
if (pKey->groupId == groupId) { if (pKey->groupId == groupId) {
return 0; return 0;
} }
taosMemoryFree((void*)*pVal); if (pVal != NULL) {
*pVal = NULL; taosMemoryFree((void*)*pVal);
*pVal = NULL;
}
} }
return -1; return -1;
} }