]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
removed freeCCtx() calls from createCCtx() so that it is not called twice during...
authorPaul Cruz <paulcruz74@fb.com>
Mon, 17 Jul 2017 18:19:23 +0000 (11:19 -0700)
committerPaul Cruz <paulcruz74@fb.com>
Mon, 17 Jul 2017 18:19:23 +0000 (11:19 -0700)
contrib/adaptive-compression/adapt.c

index d45bdf85b97af8fd446e9e895c8c36469598109a..a6ba472427075981a756f4aadc79692cfe2ddac3 100644 (file)
@@ -214,7 +214,6 @@ static adaptCCtx* createCCtx(unsigned numJobs, const char* const outFilename)
             job->lastJob = 0;
             if (!job->src.start || !job->dst.start) {
                 DISPLAY("Could not allocate buffers for jobs\n");
-                freeCCtx(ctx);
                 return NULL;
             }
             job->src.capacity = FILE_CHUNK_SIZE;
@@ -231,17 +230,14 @@ static adaptCCtx* createCCtx(unsigned numJobs, const char* const outFilename)
     ctx->input.buffer.start = malloc(ctx->input.buffer.capacity);
     if (!ctx->input.buffer.start) {
         DISPLAY("Error: could not allocate input buffer\n");
-        freeCCtx(ctx);
         return NULL;
     }
     if (!ctx->cctx) {
         DISPLAY("Error: could not allocate ZSTD_CCtx\n");
-        freeCCtx(ctx);
         return NULL;
     }
     if (!ctx->jobs) {
         DISPLAY("Error: could not allocate space for jobs during context creation\n");
-        freeCCtx(ctx);
         return NULL;
     }
     {
@@ -249,7 +245,6 @@ static adaptCCtx* createCCtx(unsigned numJobs, const char* const outFilename)
         FILE* dstFile = stdoutUsed ? stdout : fopen(outFilename, "wb");
         if (dstFile == NULL) {
             DISPLAY("Error: could not open output file\n");
-            freeCCtx(ctx);
             return NULL;
         }
         ctx->dstFile = dstFile;