]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed some issues with segfaults
authorPaul Cruz <paulcruz74@fb.com>
Tue, 4 Jul 2017 02:28:48 +0000 (19:28 -0700)
committerPaul Cruz <paulcruz74@fb.com>
Tue, 4 Jul 2017 02:28:48 +0000 (19:28 -0700)
contrib/adaptive-compression/v2 [deleted file]
contrib/adaptive-compression/v2.c

diff --git a/contrib/adaptive-compression/v2 b/contrib/adaptive-compression/v2
deleted file mode 100755 (executable)
index 38034cd..0000000
Binary files a/contrib/adaptive-compression/v2 and /dev/null differ
index eaaecb76c9d7c2cc0f427c03fa85e9fcd3a22347..edb2d0f3f39c8b7971f5e273085fdd4ea5dc4ac1 100644 (file)
@@ -64,6 +64,15 @@ static adaptCCtx* createCCtx(unsigned numJobs, const char* const outFilename)
     pthread_cond_init(&ctx->allJobsCompleted_cond, NULL);
     ctx->numJobs = numJobs;
     ctx->jobs = calloc(1, numJobs*sizeof(jobDescription));
+    {
+        unsigned u;
+        for (u=0; u<numJobs; u++) {
+            ctx->jobs[u].jobCompleted_mutex = &ctx->jobCompleted_mutex;
+            ctx->jobs[u].jobCompleted_cond = &ctx->jobCompleted_cond;
+            ctx->jobs[u].jobReady_mutex = &ctx->jobReady_mutex;
+            ctx->jobs[u].jobReady_cond = &ctx->jobReady_cond;
+        }
+    }
     ctx->nextJobID = 0;
     ctx->threadError = 0;
     ctx->allJobsCompleted = 0;
@@ -314,7 +323,7 @@ int main(int argCount, const char* argv[])
         }
         if (feof(srcFile)) break;
     }
-
+    
 cleanup:
     /* file compression completed */
     ret  |= (srcFile != NULL) ? fclose(srcFile) : 0;