@@ -1008,18 +1008,20 @@ static void ZSTDMT_releaseAllJobResources(ZSTDMT_CCtx* mtctx)
10081008{
10091009 unsigned jobID ;
10101010 DEBUGLOG (3 , "ZSTDMT_releaseAllJobResources" );
1011- for (jobID = 0 ; jobID <= mtctx -> jobIDMask ; jobID ++ ) {
1012- /* Copy the mutex/cond out */
1013- ZSTD_pthread_mutex_t const mutex = mtctx -> jobs [jobID ].job_mutex ;
1014- ZSTD_pthread_cond_t const cond = mtctx -> jobs [jobID ].job_cond ;
1015-
1016- DEBUGLOG (4 , "job%02u: release dst address %08X" , jobID , (U32 )(size_t )mtctx -> jobs [jobID ].dstBuff .start );
1017- ZSTDMT_releaseBuffer (mtctx -> bufPool , mtctx -> jobs [jobID ].dstBuff );
1018-
1019- /* Clear the job description, but keep the mutex/cond */
1020- ZSTD_memset (& mtctx -> jobs [jobID ], 0 , sizeof (mtctx -> jobs [jobID ]));
1021- mtctx -> jobs [jobID ].job_mutex = mutex ;
1022- mtctx -> jobs [jobID ].job_cond = cond ;
1011+ if (mtctx -> jobs ) {
1012+ for (jobID = 0 ; jobID <= mtctx -> jobIDMask ; jobID ++ ) {
1013+ /* Copy the mutex/cond out */
1014+ ZSTD_pthread_mutex_t const mutex = mtctx -> jobs [jobID ].job_mutex ;
1015+ ZSTD_pthread_cond_t const cond = mtctx -> jobs [jobID ].job_cond ;
1016+
1017+ DEBUGLOG (4 , "job%02u: release dst address %08X" , jobID , (U32 )(size_t )mtctx -> jobs [jobID ].dstBuff .start );
1018+ ZSTDMT_releaseBuffer (mtctx -> bufPool , mtctx -> jobs [jobID ].dstBuff );
1019+
1020+ /* Clear the job description, but keep the mutex/cond */
1021+ ZSTD_memset (& mtctx -> jobs [jobID ], 0 , sizeof (mtctx -> jobs [jobID ]));
1022+ mtctx -> jobs [jobID ].job_mutex = mutex ;
1023+ mtctx -> jobs [jobID ].job_cond = cond ;
1024+ }
10231025 }
10241026 mtctx -> inBuff .buffer = g_nullBuffer ;
10251027 mtctx -> inBuff .filled = 0 ;
0 commit comments