Merge pull request #4190 from taosdata/hotfix/test
[TD-2063]<fix> not free result resource in async callback function
This commit is contained in:
commit
1c3066963a
|
@ -881,6 +881,7 @@ int main(int argc, char *argv[]) {
|
|||
taos_close(rInfo->taos);
|
||||
}
|
||||
|
||||
taos_cleanup();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ static void queryDB(TAOS *taos, char *command) {
|
|||
fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(pSql));
|
||||
taos_free_result(pSql);
|
||||
taos_close(taos);
|
||||
taos_cleanup();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -176,6 +177,7 @@ void taos_error(TAOS *con)
|
|||
{
|
||||
fprintf(stderr, "TDengine error: %s\n", taos_errstr(con));
|
||||
taos_close(con);
|
||||
taos_cleanup();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -211,6 +213,8 @@ void taos_insert_call_back(void *param, TAOS_RES *tres, int code)
|
|||
printf("%lld mseconds to insert %d data points\n", (et - st) / 1000, points*numOfTables);
|
||||
}
|
||||
}
|
||||
|
||||
taos_free_result(tres);
|
||||
}
|
||||
|
||||
void taos_retrieve_call_back(void *param, TAOS_RES *tres, int numOfRows)
|
||||
|
@ -222,7 +226,7 @@ void taos_retrieve_call_back(void *param, TAOS_RES *tres, int numOfRows)
|
|||
|
||||
for (int i = 0; i<numOfRows; ++i) {
|
||||
// synchronous API to retrieve a row from batch of records
|
||||
/*TAOS_ROW row = */taos_fetch_row(tres);
|
||||
/*TAOS_ROW row = */(void)taos_fetch_row(tres);
|
||||
// process row
|
||||
}
|
||||
|
||||
|
@ -236,7 +240,7 @@ void taos_retrieve_call_back(void *param, TAOS_RES *tres, int numOfRows)
|
|||
if (numOfRows < 0)
|
||||
printf("%s retrieve failed, code:%d\n", pTable->name, numOfRows);
|
||||
|
||||
taos_free_result(tres);
|
||||
//taos_free_result(tres);
|
||||
printf("%d rows data retrieved from %s\n", pTable->rowsRetrieved, pTable->name);
|
||||
|
||||
tablesProcessed++;
|
||||
|
@ -246,6 +250,8 @@ void taos_retrieve_call_back(void *param, TAOS_RES *tres, int numOfRows)
|
|||
printf("%lld mseconds to query %d data rows\n", (et - st) / 1000, points * numOfTables);
|
||||
}
|
||||
}
|
||||
|
||||
taos_free_result(tres);
|
||||
}
|
||||
|
||||
void taos_select_call_back(void *param, TAOS_RES *tres, int code)
|
||||
|
@ -261,6 +267,10 @@ void taos_select_call_back(void *param, TAOS_RES *tres, int code)
|
|||
}
|
||||
else {
|
||||
printf("%s select failed, code:%d\n", pTable->name, code);
|
||||
taos_free_result(tres);
|
||||
taos_cleanup();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
taos_free_result(tres);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue