未验证 提交 2f2fabf1 编写于 作者: P plum-lihui 提交者: GitHub

Merge pull request #1446 from sangshuduo/fix-use-after-free-pSql

fix use after free pSql.
...@@ -347,8 +347,8 @@ void tscProcessAsyncRes(SSchedMsg *pMsg) { ...@@ -347,8 +347,8 @@ void tscProcessAsyncRes(SSchedMsg *pMsg) {
(*pSql->fp)(pSql->param, taosres, code); (*pSql->fp)(pSql->param, taosres, code);
if (shouldFree) { if (shouldFree) {
tscFreeSqlObj(pSql);
tscTrace("%p Async sql is automatically freed in async res", pSql); tscTrace("%p Async sql is automatically freed in async res", pSql);
tscFreeSqlObj(pSql);
} }
} }
......
...@@ -292,7 +292,7 @@ void tscKillConnection(STscObj *pObj) { ...@@ -292,7 +292,7 @@ void tscKillConnection(STscObj *pObj) {
pthread_mutex_unlock(&pObj->mutex); pthread_mutex_unlock(&pObj->mutex);
taos_close(pObj);
tscTrace("connection:%p is killed", pObj); tscTrace("connection:%p is killed", pObj);
taos_close(pObj);
} }
...@@ -600,8 +600,8 @@ void *tscProcessMsgFromServer(char *msg, void *ahandle, void *thandle) { ...@@ -600,8 +600,8 @@ void *tscProcessMsgFromServer(char *msg, void *ahandle, void *thandle) {
taos_close(pObj); taos_close(pObj);
tscTrace("%p Async sql close failed connection", pSql); tscTrace("%p Async sql close failed connection", pSql);
} else { } else {
tscFreeSqlObj(pSql);
tscTrace("%p Async sql is automatically freed", pSql); tscTrace("%p Async sql is automatically freed", pSql);
tscFreeSqlObj(pSql);
} }
} }
} }
......
...@@ -796,8 +796,8 @@ void taos_free_result_imp(TAOS_RES *res, int keepCmd) { ...@@ -796,8 +796,8 @@ void taos_free_result_imp(TAOS_RES *res, int keepCmd) {
tscTrace("%p qhandle is null, abort free, fp:%p", pSql, pSql->fp); tscTrace("%p qhandle is null, abort free, fp:%p", pSql, pSql->fp);
if (pSql->fp != NULL) { if (pSql->fp != NULL) {
pSql->thandle = NULL; pSql->thandle = NULL;
tscFreeSqlObj(pSql);
tscTrace("%p Async SqlObj is freed by app", pSql); tscTrace("%p Async SqlObj is freed by app", pSql);
tscFreeSqlObj(pSql);
} else if (keepCmd) { } else if (keepCmd) {
tscFreeSqlResult(pSql); tscFreeSqlResult(pSql);
} else { } else {
......
...@@ -582,10 +582,10 @@ void taos_close_stream(TAOS_STREAM *handle) { ...@@ -582,10 +582,10 @@ void taos_close_stream(TAOS_STREAM *handle) {
tscRemoveFromStreamList(pStream, pSql); tscRemoveFromStreamList(pStream, pSql);
taosTmrStopA(&(pStream->pTimer)); taosTmrStopA(&(pStream->pTimer));
tscTrace("%p stream:%p is closed", pSql, pStream);
tscFreeSqlObj(pSql); tscFreeSqlObj(pSql);
pStream->pSql = NULL; pStream->pSql = NULL;
tscTrace("%p stream:%p is closed", pSql, pStream);
tfree(pStream); tfree(pStream);
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册