avoid mem leak
This commit is contained in:
parent
9f8f5374aa
commit
449051cda6
|
@ -1056,7 +1056,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
|
||||||
rocksdb_readoptions_t* opts = pState->pTdbState->readOpts; \
|
rocksdb_readoptions_t* opts = pState->pTdbState->readOpts; \
|
||||||
size_t len = 0; \
|
size_t len = 0; \
|
||||||
char* val = rocksdb_get_cf(db, opts, pHandle, (const char*)buf, klen, (size_t*)&len, &err); \
|
char* val = rocksdb_get_cf(db, opts, pHandle, (const char*)buf, klen, (size_t*)&len, &err); \
|
||||||
if (val == NULL) { \
|
if (val == NULL || len == 0) { \
|
||||||
if (err == NULL) { \
|
if (err == NULL) { \
|
||||||
qTrace("streamState str: %s failed to read from %s_%s, err: not exist", toString, pState->pTdbState->idstr, \
|
qTrace("streamState str: %s failed to read from %s_%s, err: not exist", toString, pState->pTdbState->idstr, \
|
||||||
funcname); \
|
funcname); \
|
||||||
|
@ -1069,7 +1069,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
|
||||||
} else { \
|
} else { \
|
||||||
char* p = NULL; \
|
char* p = NULL; \
|
||||||
int32_t len = ginitDict[i].deValueFunc(val, len, NULL, (char**)pVal); \
|
int32_t len = ginitDict[i].deValueFunc(val, len, NULL, (char**)pVal); \
|
||||||
if (len < 0) { \
|
if (len <= 0) { \
|
||||||
qError("streamState str: %s failed to read from %s_%s, err: already ttl ", toString, pState->pTdbState->idstr, \
|
qError("streamState str: %s failed to read from %s_%s, err: already ttl ", toString, pState->pTdbState->idstr, \
|
||||||
funcname); \
|
funcname); \
|
||||||
code = -1; \
|
code = -1; \
|
||||||
|
|
|
@ -416,7 +416,7 @@ int32_t deleteExpiredCheckPoint(SStreamFileState* pFileState, TSKEY mark) {
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
memcpy(buf, taskKey, strlen(taskKey));
|
memcpy(buf, taskKey, strlen(taskKey));
|
||||||
code = streamDefaultGet_rocksdb(pFileState->pFileStore, buf, &val, &len);
|
code = streamDefaultGet_rocksdb(pFileState->pFileStore, buf, &val, &len);
|
||||||
if (code != 0) {
|
if (code != 0 || len == 0 || val == NULL) {
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
sscanf(val, "%" PRId64 "", &maxCheckPointId);
|
sscanf(val, "%" PRId64 "", &maxCheckPointId);
|
||||||
|
|
Loading…
Reference in New Issue