From f6bbd2c5f1bc28355c284fcbd61e7f52cdaf3ff8 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 21 Jan 2022 10:27:54 +0800 Subject: [PATCH] [TD-11222]: Histogram function --- src/client/src/tscSQLParser.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index e41141c286..197092c3de 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3442,6 +3442,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col startIndex++; } } else { + tfree(intervals); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); } @@ -3458,15 +3459,18 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col intervals = tcalloc(numBins, sizeof(double)); cJSON *bin = binDesc->child; if (bin == NULL) { + tfree(intervals); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); } int i = 0; while (bin) { intervals[i] = bin->valuedouble; if (!cJSON_IsNumber(bin)) { + tfree(intervals); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); } if (i != 0 && intervals[i] <= intervals[i - 1]) { + tfree(intervals); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg22); } bin = bin->next; -- GitLab