added ZBUFF_createCCtx_advanced and ZBUFF_createDCtx_advanced

This commit is contained in:
inikep
2016-05-23 17:04:23 +02:00
parent 107e243195
commit 13ba880b49
5 changed files with 83 additions and 23 deletions
+4 -1
View File
@@ -153,7 +153,7 @@ ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
{
ZSTD_DCtx* dctx;
if (!customMem.customAlloc || !customMem.customFree)
if (!customMem.customAlloc && !customMem.customFree)
{
dctx = (ZSTD_DCtx*) malloc(sizeof(ZSTD_DCtx));
if (!dctx) return NULL;
@@ -164,6 +164,9 @@ ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
return dctx;
}
if (!customMem.customAlloc || !customMem.customFree)
return NULL;
dctx = (ZSTD_DCtx*) customMem.customAlloc(sizeof(ZSTD_DCtx));
if (!dctx) return NULL;
dctx->customAlloc = customMem.customAlloc;