fix mem problem
This commit is contained in:
parent
c35513a507
commit
ec3c967fe7
|
@ -66,14 +66,15 @@ typedef struct TdFile {
|
|||
#define FILE_WITH_LOCK 1
|
||||
|
||||
#ifdef BUILD_WITH_RAND_ERR
|
||||
#define STUB_RAND_IO_ERR(ret) \
|
||||
if (tsEnableRandErr && (tsRandErrScope & RAND_ERR_FILE)) { \
|
||||
uint32_t r = taosRand() % tsRandErrDivisor; \
|
||||
if ((r + 1) <= tsRandErrChance) { \
|
||||
errno = EIO; \
|
||||
terrno = TAOS_SYSTEM_ERROR(errno); \
|
||||
return (ret); \
|
||||
} \
|
||||
#define STUB_RAND_IO_ERR(ret) \
|
||||
if (tsEnableRandErr && (tsRandErrScope & RAND_ERR_FILE)) { \
|
||||
uint32_t r = taosRand() % tsRandErrDivisor; \
|
||||
if ((r + 1) <= tsRandErrChance) { \
|
||||
errno = EIO; \
|
||||
terrno = TAOS_SYSTEM_ERROR(errno); \
|
||||
uError("random io error: %s, %s", tstrerror(terrno), __func__); \
|
||||
return (ret); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define STUB_RAND_IO_ERR(ret)
|
||||
|
|
|
@ -308,6 +308,7 @@ void *taosMemoryCalloc(int64_t num, int64_t size) {
|
|||
uint32_t r = taosRand() % tsRandErrDivisor;
|
||||
if ((r + 1) <= tsRandErrChance) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
uError("random memory error: %s, %s", tstrerror(terrno), __func__);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue