Return error code when initializing NULL cctxParams

This commit is contained in:
Stella Lau 2017-08-21 11:44:58 -07:00
parent 25be09c6b4
commit 560b34f6d2

View File

@ -268,6 +268,7 @@ size_t ZSTD_resetCCtxParams(ZSTD_CCtx_params* params)
size_t ZSTD_initCCtxParams(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params) size_t ZSTD_initCCtxParams(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params)
{ {
if (!cctxParams) { return ERROR(GENERIC); }
memset(cctxParams, 0, sizeof(ZSTD_CCtx_params)); memset(cctxParams, 0, sizeof(ZSTD_CCtx_params));
cctxParams->cParams = params.cParams; cctxParams->cParams = params.cParams;
cctxParams->fParams = params.fParams; cctxParams->fParams = params.fParams;