crypto/init.c:388: error: MEMORY_LEAK
  memory dynamically allocated by call to `ossl_init_get_thread_local()` at line 370, column 44 is not reachable after line 388, column 9.
Showing all 38 steps of the trace


crypto/init.c:368:1: start of procedure ossl_init_thread_start()
366.   }
367.   
368. > int ossl_init_thread_start(uint64_t opts)
369.   {
370.       struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);

crypto/init.c:370:5: 
368.   int ossl_init_thread_start(uint64_t opts)
369.   {
370. >     struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
371.   
372.       if (locals == NULL)

crypto/init.c:86:1: start of procedure ossl_init_get_thread_local()
  84.   }
  85.   
  86. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
  87.   {
  88.       struct thread_local_inits_st *local =

crypto/init.c:88:5: 
  86.   static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
  87.   {
  88. >     struct thread_local_inits_st *local =
  89.           CRYPTO_THREAD_get_local(&threadstopkey);
  90.   

crypto/threads_pthread.c:120:1: start of procedure CRYPTO_THREAD_get_local()
    118.   }
    119.   
    120. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
    121.   {
    122.       return pthread_getspecific(*key);

crypto/threads_pthread.c:122:5: Skipping pthread_getspecific(): method has no implementation
    120.   void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
    121.   {
    122.       return pthread_getspecific(*key);
               ^
    123.   }
    124.   

crypto/threads_pthread.c:123:1: return from a call to CRYPTO_THREAD_get_local
    121.   {
    122.       return pthread_getspecific(*key);
    123. > }
    124.   
    125.   int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)

crypto/init.c:91:9: Taking true branch
  89.           CRYPTO_THREAD_get_local(&threadstopkey);
  90.   
  91.       if (local == NULL && alloc) {
                ^
  92.           local = OPENSSL_zalloc(sizeof *local);
  93.           CRYPTO_THREAD_set_local(&threadstopkey, local);

crypto/init.c:91:26: Taking true branch
  89.           CRYPTO_THREAD_get_local(&threadstopkey);
  90.   
  91.       if (local == NULL && alloc) {
                                 ^
  92.           local = OPENSSL_zalloc(sizeof *local);
  93.           CRYPTO_THREAD_set_local(&threadstopkey, local);

crypto/init.c:92:9: 
  90.   
  91.       if (local == NULL && alloc) {
  92. >         local = OPENSSL_zalloc(sizeof *local);
  93.           CRYPTO_THREAD_set_local(&threadstopkey, local);
  94.       }

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
    144.   }
    145.   
    146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148. >     void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      124.           return malloc_impl(num, file, line);
      125.   

crypto/mem.c:126:9: Taking false branch
      124.           return malloc_impl(num, file, line);
      125.   
      126.       if (num <= 0)
                     ^
      127.           return NULL;
      128.   

crypto/mem.c:129:5: 
      127.           return NULL;
      128.   
      129. >     allow_customize = 0;
      130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:139:24: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:140:5: 
      138.   #else
      139.       osslargused(file); osslargused(line);
      140. >     ret = malloc(num);
      141.   #endif
      142.   

crypto/mem.c:143:5: 
      141.   #endif
      142.   
      143. >     return ret;
      144.   }
      145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
      142.   
      143.       return ret;
      144. > }
      145.   
      146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking true branch
    148.       void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)
                   ^
    151.           memset(ret, 0, num);
    152.       return ret;

crypto/mem.c:151:9: 
    149.   
    150.       if (ret != NULL)
    151. >         memset(ret, 0, num);
    152.       return ret;
    153.   }

crypto/mem.c:152:5: 
    150.       if (ret != NULL)
    151.           memset(ret, 0, num);
    152. >     return ret;
    153.   }
    154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
    151.           memset(ret, 0, num);
    152.       return ret;
    153. > }
    154.   
    155.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/init.c:93:9: 
  91.       if (local == NULL && alloc) {
  92.           local = OPENSSL_zalloc(sizeof *local);
  93. >         CRYPTO_THREAD_set_local(&threadstopkey, local);
  94.       }
  95.       if (!alloc) {

crypto/threads_pthread.c:125:1: start of procedure CRYPTO_THREAD_set_local()
    123.   }
    124.   
    125. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
    126.   {
    127.       if (pthread_setspecific(*key, val) != 0)

crypto/threads_pthread.c:127:9: Taking true branch
    125.   int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
    126.   {
    127.       if (pthread_setspecific(*key, val) != 0)
                   ^
    128.           return 0;
    129.   

crypto/threads_pthread.c:128:9: 
    126.   {
    127.       if (pthread_setspecific(*key, val) != 0)
    128. >         return 0;
    129.   
    130.       return 1;

crypto/threads_pthread.c:131:1: return from a call to CRYPTO_THREAD_set_local
    129.   
    130.       return 1;
    131. > }
    132.   
    133.   int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key)

crypto/init.c:95:10: Taking false branch
  93.           CRYPTO_THREAD_set_local(&threadstopkey, local);
  94.       }
  95.       if (!alloc) {
                 ^
  96.           CRYPTO_THREAD_set_local(&threadstopkey, NULL);
  97.       }

crypto/init.c:99:5: 
  97.       }
  98.   
  99. >     return local;
  100.   }
  101.   

crypto/init.c:100:1: return from a call to ossl_init_get_thread_local
  98.   
  99.       return local;
  100. > }
  101.   
  102.   typedef struct ossl_init_stop_st OPENSSL_INIT_STOP;

crypto/init.c:372:9: Taking false branch
370.       struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
371.   
372.       if (locals == NULL)
               ^
373.           return 0;
374.   

crypto/init.c:375:9: Taking false branch
373.           return 0;
374.   
375.       if (opts & OPENSSL_INIT_THREAD_ASYNC) {
               ^
376.   #ifdef OPENSSL_INIT_DEBUG
377.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "

crypto/init.c:383:9: Taking true branch
381.       }
382.   
383.       if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
               ^
384.   #ifdef OPENSSL_INIT_DEBUG
385.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "

crypto/init.c:388:9: 
386.                           "marking thread for err_state\n");
387.   #endif
388. >         locals->err_state = 1;
389.       }
390.   
