Set some parameters to zero before initializing cdict

This commit is contained in:
Stella Lau
2017-08-21 11:35:46 -07:00
parent 502031ca10
commit 25be09c6b4
+1 -4
View File
@@ -3708,15 +3708,12 @@ ZSTD_CDict* ZSTD_createCDict_advanced_opaque(
{ ZSTD_CDict* const cdict = (ZSTD_CDict*)ZSTD_malloc(sizeof(ZSTD_CDict), customMem); { ZSTD_CDict* const cdict = (ZSTD_CDict*)ZSTD_malloc(sizeof(ZSTD_CDict), customMem);
ZSTD_CCtx* const cctx = ZSTD_createCCtx_advanced(customMem); ZSTD_CCtx* const cctx = ZSTD_createCCtx_advanced(customMem);
if (!cdict || !cctx) { if (!cdict || !cctx) {
ZSTD_free(cdict, customMem); ZSTD_free(cdict, customMem);
ZSTD_freeCCtx(cctx); ZSTD_freeCCtx(cctx);
return NULL; return NULL;
} }
cdict->refContext = cctx; cdict->refContext = cctx;
/* TODO: What should be zero? */
if (ZSTD_isError( ZSTD_initCDict_internal_opaque( if (ZSTD_isError( ZSTD_initCDict_internal_opaque(
cdict, cdict,
dictBuffer, dictSize, dictBuffer, dictSize,
@@ -4256,7 +4253,7 @@ size_t ZSTD_compressStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuf
return ZSTD_compressStream_generic(zcs, output, input, ZSTD_e_continue); return ZSTD_compressStream_generic(zcs, output, input, ZSTD_e_continue);
} }
/*! ZSTDMT_initCStream_internal() : /*! ZSTDMT_initCStream_internal_opaque() :
* Private use only. Init streaming operation. * Private use only. Init streaming operation.
* expects params to be valid. * expects params to be valid.
* must receive dict, or cdict, or none, but not both. * must receive dict, or cdict, or none, but not both.