Merge pull request #7 from siddontang/master

fix memory leak when read failed
This commit is contained in:
slguan 2019-07-13 10:10:17 +08:00 committed by GitHub
commit e28077b677
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -199,6 +199,7 @@ static void taosProcessTcpData(void *param) {
if (headLen != sizeof(STaosHeader)) {
tError("%s read error, headLen:%d", pThreadObj->label, headLen);
taosCleanUpFdObj(pFdObj);
free(buffer);
continue;
}
@ -214,6 +215,7 @@ static void taosProcessTcpData(void *param) {
if (leftLen != retLen) {
tError("%s read error, leftLen:%d retLen:%d", pThreadObj->label, leftLen, retLen);
taosCleanUpFdObj(pFdObj);
free(buffer);
continue;
}