]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
dst buffer should use ZSTD_compressBound to determine how much space it needs
authorPaul Cruz <paulcruz74@fb.com>
Mon, 10 Jul 2017 23:10:19 +0000 (16:10 -0700)
committerPaul Cruz <paulcruz74@fb.com>
Mon, 10 Jul 2017 23:10:19 +0000 (16:10 -0700)
contrib/adaptive-compression/adapt.c

index 1299264d89203f915967c193a0aa4b2e715c8eb6..e1ac0aaf389746a3c5d779e2ffabc36a2492bd5c 100644 (file)
@@ -142,7 +142,7 @@ static adaptCCtx* createCCtx(unsigned numJobs, const char* const outFilename)
         for (jobNum=0; jobNum<numJobs; jobNum++) {
             jobDescription* job = &ctx->jobs[jobNum];
             job->src.start = malloc(FILE_CHUNK_SIZE);
-            job->dst.start = malloc(FILE_CHUNK_SIZE);
+            job->dst.start = malloc(ZSTD_compressBound(FILE_CHUNK_SIZE));
             if (!job->src.start || !job->dst.start) {
                 DISPLAY("Could not allocate buffers for jobs\n");
                 freeCCtx(ctx);