]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added detach statements to prevent resource leak
authorPaul Cruz <paulcruz74@gmail.com>
Wed, 2 Aug 2017 00:36:13 +0000 (17:36 -0700)
committerPaul Cruz <paulcruz74@gmail.com>
Wed, 2 Aug 2017 00:36:13 +0000 (17:36 -0700)
contrib/adaptive-compression/adapt.c

index eeb4c2ea97f4e9608cc783278281a80b2251a10e..eef6c93266411373d5ff5b2353e7529b4f5df760 100644 (file)
@@ -785,6 +785,11 @@ static int performCompression(adaptCCtx* ctx, FILE* const srcFile, outputThreadA
             signalErrorToThreads(ctx);
             return 1;
         }
+        else if (pthread_detach(out)) {
+               DISPLAY("Error: could not detach output thread\n");
+               signalErrorToThreads(ctx);
+               return 1;
+        }
     }
 
     /* create compression thread */
@@ -795,6 +800,11 @@ static int performCompression(adaptCCtx* ctx, FILE* const srcFile, outputThreadA
             signalErrorToThreads(ctx);
             return 1;
         }
+        else if (pthread_detach(compression)) {
+               DISPLAY("Error: could not detach compression thread\n");
+               signalErrorToThreads(ctx);
+               return 1;
+        }
     }
     {
         unsigned currJob = 0;