test/drbgtest.c: call OPENSSL_thread_stop() explicitly
authorRichard Levitte <levitte@openssl.org>
Wed, 6 Feb 2019 19:51:47 +0000 (20:51 +0100)
committerRichard Levitte <levitte@openssl.org>
Thu, 7 Feb 2019 19:16:18 +0000 (20:16 +0100)
The manual says this in its notes:

    ... and therefore applications using static linking should also call
    OPENSSL_thread_stop() on each thread. ...

Fixes #8171

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/8173)

(cherry picked from commit 03cdfe1efaf2a3b5192b8cb3ef331939af7bfeb8)

test/drbgtest.c

index b690475e0cad3e75375387df12500ab3ba2b4179..67fc1aaa6b44b4491fb980c84690f2f475cfcd6a 100644 (file)
@@ -830,6 +830,11 @@ typedef HANDLE thread_t;
 static DWORD WINAPI thread_run(LPVOID arg)
 {
     run_multi_thread_test();
+    /*
+     * Because we're linking with a static library, we must stop each
+     * thread explicitly, or so says OPENSSL_thread_stop(3)
+     */
+    OPENSSL_thread_stop();
     return 0;
 }
 
@@ -851,6 +856,11 @@ typedef pthread_t thread_t;
 static void *thread_run(void *arg)
 {
     run_multi_thread_test();
+    /*
+     * Because we're linking with a static library, we must stop each
+     * thread explicitly, or so says OPENSSL_thread_stop(3)
+     */
+    OPENSSL_thread_stop();
     return NULL;
 }