Properly zero cipher_data for ChaCha20-Poly1305 on cleanup
[openssl.git] / crypto / threads_win.c
index 5347c9e46bbdd24a817619d63bbde972c3e0c04a..4e0de908ee269510d8831c7110606722c50f8fe7 100644 (file)
@@ -78,8 +78,8 @@ int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
     do {
         result = InterlockedCompareExchange(lock, ONCE_ININIT, ONCE_UNINITED);
         if (result == ONCE_UNINITED) {
-            *lock = ONCE_DONE;
             init();
+            *lock = ONCE_DONE;
             return 1;
         }
     } while (result == ONCE_ININIT);