mirror of
https://github.com/facebook/zstd.git
synced 2025-10-08 00:04:02 -04:00
fixed ZSTDMT_createCCtx() : checked inner objects are properly created
This commit is contained in:
parent
8ce1cc2bec
commit
085179bb78
@ -206,12 +206,16 @@ ZSTDMT_CCtx *ZSTDMT_createCCtx(unsigned nbThreads)
|
|||||||
cctx->factory = POOL_create(nbThreads, 1);
|
cctx->factory = POOL_create(nbThreads, 1);
|
||||||
cctx->buffPool = ZSTDMT_createBufferPool(nbThreads);
|
cctx->buffPool = ZSTDMT_createBufferPool(nbThreads);
|
||||||
cctx->cctxPool = ZSTDMT_createCCtxPool(nbThreads);
|
cctx->cctxPool = ZSTDMT_createCCtxPool(nbThreads);
|
||||||
pthread_mutex_init(&cctx->jobCompleted_mutex, NULL);
|
if (!cctx->factory | !cctx->buffPool | !cctx->cctxPool) { /* one object was not created */
|
||||||
|
ZSTDMT_freeCCtx(cctx);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
pthread_mutex_init(&cctx->jobCompleted_mutex, NULL); /* Todo : check init function return */
|
||||||
pthread_cond_init(&cctx->jobCompleted_cond, NULL);
|
pthread_cond_init(&cctx->jobCompleted_cond, NULL);
|
||||||
return cctx;
|
return cctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* mtctx) /* incompleted ! */
|
size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* mtctx)
|
||||||
{
|
{
|
||||||
POOL_free(mtctx->factory);
|
POOL_free(mtctx->factory);
|
||||||
ZSTDMT_freeBufferPool(mtctx->buffPool);
|
ZSTDMT_freeBufferPool(mtctx->buffPool);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user