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
@@ -128,7 +128,7 @@ ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem)
{
ZSTD_CCtx* ctx;
if (!customMem.customAlloc || !customMem.customFree)
if (!customMem.customAlloc && !customMem.customFree)
{
ctx = (ZSTD_CCtx*) calloc(1, sizeof(ZSTD_CCtx));
if (!ctx) return NULL;
@@ -138,6 +138,9 @@ ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem)
return ctx;
}
if (!customMem.customAlloc || !customMem.customFree)
return NULL;
ctx = (ZSTD_CCtx*) customMem.customAlloc(sizeof(ZSTD_CCtx));
if (!ctx) return NULL;