fixed: deallocation of structures in case of error in ZBUFF_createCCtx and ZBUFF_createDCtx

This commit is contained in:
inikep
2016-06-03 16:36:50 +02:00
parent f040be9850
commit 3640396b1a
5 changed files with 11 additions and 11 deletions
+2 -1
View File
@@ -143,7 +143,8 @@ ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem)
size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx)
{
cctx->customMem.customFree(cctx->customMem.opaque, cctx->workSpace);
if (cctx==NULL) return 0; /* support free on NULL */
if (cctx->workSpace) cctx->customMem.customFree(cctx->customMem.opaque, cctx->workSpace);
cctx->customMem.customFree(cctx->customMem.opaque, cctx);
return 0; /* reserved as a potential error code in the future */
}