Skip to content

Commit

Permalink
fix: add sem free and init log (#19192)
Browse files Browse the repository at this point in the history
Co-authored-by: dapan1121 <[email protected]>
  • Loading branch information
sangshuduo and dapan1121 authored Dec 27, 2022
1 parent 11b9175 commit 2176aa2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/libs/scheduler/src/schJob.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ void schFreeJobImpl(void *job) {
taosMemoryFreeClear(pJob->userRes.execRes);
taosMemoryFreeClear(pJob->fetchRes);
taosMemoryFreeClear(pJob->sql);
tsem_destroy(&pJob->rspSem);
taosMemoryFree(pJob);

int32_t jobNum = atomic_sub_fetch_32(&schMgmt.jobNum, 1);
Expand Down Expand Up @@ -748,7 +749,10 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) {
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}

tsem_init(&pJob->rspSem, 0, 0);
if (tsem_init(&pJob->rspSem, 0, 0)) {
SCH_JOB_ELOG("tsem_init failed, errno:%d", errno);
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}

pJob->refId = taosAddRef(schMgmt.jobRef, pJob);
if (pJob->refId < 0) {
Expand Down

0 comments on commit 2176aa2

Please sign in to comment.