diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 849fe0ba73c20c16db40a593a38648566ca1265d..a025829343e6efeaedcb692eb9452743ea4cbf1c 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -211,7 +211,9 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, } else { printf("taos connect failed, reason: %s.\n\n", tstrerror(terrno)); } + int32_t lastError = terrno; taos_free_result(pSql); + if (terrno != lastError) terrno = lastError; taos_close(pObj); return NULL; }