add close null pointer validate

This commit is contained in:
dapan1121 2022-06-18 08:21:31 +08:00
parent 744bc92f68
commit 38a481afce
1 changed files with 9 additions and 0 deletions

View File

@ -119,6 +119,10 @@ void taos_close_internal(void *taos) {
} }
void taos_close(TAOS *taos) { void taos_close(TAOS *taos) {
if (taos == NULL) {
return;
}
STscObj* pObj = acquireTscObj(*(int64_t*)taos); STscObj* pObj = acquireTscObj(*(int64_t*)taos);
if (NULL == pObj) { if (NULL == pObj) {
return; return;
@ -209,6 +213,11 @@ static void syncQueryFn(void *param, void *res, int32_t code) {
} }
TAOS_RES *taos_query(TAOS *taos, const char *sql) { TAOS_RES *taos_query(TAOS *taos, const char *sql) {
if (NULL == taos) {
terrno = TSDB_CODE_TSC_DISCONNECTED;
return NULL;
}
STscObj* pTscObj = acquireTscObj(*(int64_t*)taos); STscObj* pTscObj = acquireTscObj(*(int64_t*)taos);
if (pTscObj == NULL || sql == NULL) { if (pTscObj == NULL || sql == NULL) {
terrno = TSDB_CODE_TSC_DISCONNECTED; terrno = TSDB_CODE_TSC_DISCONNECTED;