提交 e7bd96fa 编写于 作者: B Benguang Zhao

fix: check for out of memory during realloc in parseSmlValue

上级 8ad91e1f
......@@ -2353,7 +2353,12 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **idx,
if (start < cur) {
if (bufSize <= len + (cur - start)) {
bufSize *= 2;
value = realloc(value, bufSize);
char *tmp = realloc(value, bufSize);
if (tmp == NULL) {
ret = TSDB_CODE_TSC_OUT_OF_MEMORY;
goto error;
}
value = tmp;
}
memcpy(value + len, start, cur - start); // [start, cur)
len += cur - start;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册