File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5757,12 +5757,13 @@ int wolfSSL_Init(void)
57575757
57585758 if (ret == WOLFSSL_SUCCESS) {
57595759 initRefCount++;
5760+ } else {
5761+ initRefCount = 1; /* Force cleanup */
57605762 }
57615763
57625764 wc_UnLockMutex(&inits_count_mutex);
57635765
57645766 if (ret != WOLFSSL_SUCCESS) {
5765- initRefCount = 1; /* Force cleanup */
57665767 (void)wolfSSL_Cleanup(); /* Ignore any error from cleanup */
57675768 }
57685769
@@ -23923,18 +23924,22 @@ int wolfSSL_RAND_bytes(unsigned char* buf, int num)
2392323924 }
2392423925#endif
2392523926#ifdef HAVE_GLOBAL_RNG
23926- if (initGlobalRNG) {
23927- if (wc_LockMutex(&globalRNGMutex) != 0) {
23928- WOLFSSL_MSG("Bad Lock Mutex rng");
23929- return ret;
23930- }
23927+ if (wc_LockMutex(&globalRNGMutex) != 0) {
23928+ WOLFSSL_MSG("Bad Lock Mutex rng");
23929+ return ret;
23930+ }
2393123931
23932+ if (initGlobalRNG) {
2393223933 rng = &globalRNG;
2393323934 used_global = 1;
2393423935 }
2393523936 else
2393623937#endif
2393723938 {
23939+ #ifdef HAVE_GLOBAL_RNG
23940+ wc_UnLockMutex(&globalRNGMutex);
23941+ #endif
23942+
2393823943 #ifdef WOLFSSL_SMALL_STACK
2393923944 tmpRNG = (WC_RNG*)XMALLOC(sizeof(WC_RNG), NULL, DYNAMIC_TYPE_RNG);
2394023945 if (tmpRNG == NULL)
You can’t perform that action at this time.
0 commit comments