1
0
mirror of https://github.com/facebook/zstd.git synced 2025-09-07 01:06:59 +03:00

Merge pull request #4419 from AZero13/patch-1

Check for job before releasing resources
This commit is contained in:
Yann Collet
2025-08-19 17:02:48 -07:00
committed by GitHub

View File

@@ -1008,6 +1008,7 @@ static void ZSTDMT_releaseAllJobResources(ZSTDMT_CCtx* mtctx)
{
unsigned jobID;
DEBUGLOG(3, "ZSTDMT_releaseAllJobResources");
if (mtctx->jobs) {
for (jobID=0; jobID <= mtctx->jobIDMask; jobID++) {
/* Copy the mutex/cond out */
ZSTD_pthread_mutex_t const mutex = mtctx->jobs[jobID].job_mutex;
@@ -1021,6 +1022,7 @@ static void ZSTDMT_releaseAllJobResources(ZSTDMT_CCtx* mtctx)
mtctx->jobs[jobID].job_mutex = mutex;
mtctx->jobs[jobID].job_cond = cond;
}
}
mtctx->inBuff.buffer = g_nullBuffer;
mtctx->inBuff.filled = 0;
mtctx->allJobsCompleted = 1;