From 76c2993e905992688f446cf0e859047ece8c7fc6 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Fri, 11 Jun 2021 16:16:05 +0800 Subject: [PATCH] add null pointer check --- src/client/src/tscPrepare.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 3f12bc811b..b6d1f7f17b 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -1462,6 +1462,11 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) { STMT_RET(TSDB_CODE_TSC_DISCONNECTED); } + if (sql == NULL) { + tscError("sql is NULL"); + STMT_RET(invalidOperationMsg(tscGetErrorMsgPayload(&pStmt->pSql->cmd), "sql is NULL")); + } + if (pStmt->last != STMT_INIT) { tscError("prepare status error, last:%d", pStmt->last); STMT_RET(invalidOperationMsg(tscGetErrorMsgPayload(&pStmt->pSql->cmd), "prepare status error")); -- GitLab