removed freeCCtx() calls from createCCtx() so that it is not called twice during errors
parent
50ce4eaeb6
commit
044e40db5a
|
@ -214,7 +214,6 @@ static adaptCCtx* createCCtx(unsigned numJobs, const char* const outFilename)
|
||||||
job->lastJob = 0;
|
job->lastJob = 0;
|
||||||
if (!job->src.start || !job->dst.start) {
|
if (!job->src.start || !job->dst.start) {
|
||||||
DISPLAY("Could not allocate buffers for jobs\n");
|
DISPLAY("Could not allocate buffers for jobs\n");
|
||||||
freeCCtx(ctx);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
job->src.capacity = FILE_CHUNK_SIZE;
|
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);
|
ctx->input.buffer.start = malloc(ctx->input.buffer.capacity);
|
||||||
if (!ctx->input.buffer.start) {
|
if (!ctx->input.buffer.start) {
|
||||||
DISPLAY("Error: could not allocate input buffer\n");
|
DISPLAY("Error: could not allocate input buffer\n");
|
||||||
freeCCtx(ctx);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!ctx->cctx) {
|
if (!ctx->cctx) {
|
||||||
DISPLAY("Error: could not allocate ZSTD_CCtx\n");
|
DISPLAY("Error: could not allocate ZSTD_CCtx\n");
|
||||||
freeCCtx(ctx);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!ctx->jobs) {
|
if (!ctx->jobs) {
|
||||||
DISPLAY("Error: could not allocate space for jobs during context creation\n");
|
DISPLAY("Error: could not allocate space for jobs during context creation\n");
|
||||||
freeCCtx(ctx);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -249,7 +245,6 @@ static adaptCCtx* createCCtx(unsigned numJobs, const char* const outFilename)
|
||||||
FILE* dstFile = stdoutUsed ? stdout : fopen(outFilename, "wb");
|
FILE* dstFile = stdoutUsed ? stdout : fopen(outFilename, "wb");
|
||||||
if (dstFile == NULL) {
|
if (dstFile == NULL) {
|
||||||
DISPLAY("Error: could not open output file\n");
|
DISPLAY("Error: could not open output file\n");
|
||||||
freeCCtx(ctx);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ctx->dstFile = dstFile;
|
ctx->dstFile = dstFile;
|
||||||
|
|
Loading…
Reference in New Issue