]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add check for allocation
authorsenhuang42 <senhuang96@fb.com>
Wed, 28 Oct 2020 20:22:22 +0000 (16:22 -0400)
committersenhuang42 <senhuang96@fb.com>
Wed, 28 Oct 2020 20:22:22 +0000 (16:22 -0400)
tests/fuzzer.c

index eb1b28c1c79644daf5d85407a608d8766d5853ae..c2f5d5707fe7fdb7454367e41aad6c3d658e0512 100644 (file)
@@ -721,6 +721,11 @@ static int basicUnitTests(U32 const seed, double compressibility)
     DISPLAYLEVEL(3, "test%3i : LDM + opt parser with small uncompressible block ", testNb++);
     {   ZSTD_CCtx* cctx = ZSTD_createCCtx();
         ZSTD_DCtx* dctx = ZSTD_createDCtx();
+        if (!cctx || !dctx) {
+            DISPLAY("Not enough memory, aborting\n");
+            testResult = 1;
+            goto _end;
+        }
         size_t const srcSize = 300 KB;
         size_t const flushSize = 128 KB + 5;
         size_t const dstSize = ZSTD_compressBound(srcSize);