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


crypto/init.c:309:1: start of procedure ossl_init_thread_start()
307.   }
308.   
309. > int ossl_init_thread_start(uint64_t opts)
310.   {
311.       struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);

crypto/init.c:311:5: 
309.   int ossl_init_thread_start(uint64_t opts)
310.   {
311. >     struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
312.   
313.       if (locals == NULL)

crypto/init.c:37:1: start of procedure ossl_init_get_thread_local()
  35.   }
  36.   
  37. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
  38.   {
  39.       struct thread_local_inits_st *local =

crypto/init.c:39:5: 
  37.   static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
  38.   {
  39. >     struct thread_local_inits_st *local =
  40.           CRYPTO_THREAD_get_local(&threadstopkey);
  41.   

crypto/threads_pthread.c:79:1: start of procedure CRYPTO_THREAD_get_local()
    77.   }
    78.   
    79. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
    80.   {
    81.       return pthread_getspecific(*key);

crypto/threads_pthread.c:81:5: Skipping pthread_getspecific(): method has no implementation
    79.   void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
    80.   {
    81.       return pthread_getspecific(*key);
              ^
    82.   }
    83.   

crypto/threads_pthread.c:82:1: return from a call to CRYPTO_THREAD_get_local
    80.   {
    81.       return pthread_getspecific(*key);
    82. > }
    83.   
    84.   int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)

crypto/init.c:42:9: Taking true branch
  40.           CRYPTO_THREAD_get_local(&threadstopkey);
  41.   
  42.       if (local == NULL && alloc) {
                ^
  43.           local = OPENSSL_zalloc(sizeof *local);
  44.           CRYPTO_THREAD_set_local(&threadstopkey, local);

crypto/init.c:42:26: Taking true branch
  40.           CRYPTO_THREAD_get_local(&threadstopkey);
  41.   
  42.       if (local == NULL && alloc) {
                                 ^
  43.           local = OPENSSL_zalloc(sizeof *local);
  44.           CRYPTO_THREAD_set_local(&threadstopkey, local);

crypto/init.c:43:9: 
  41.   
  42.       if (local == NULL && alloc) {
  43. >         local = OPENSSL_zalloc(sizeof *local);
  44.           CRYPTO_THREAD_set_local(&threadstopkey, local);
  45.       }

crypto/mem.c:98:1: start of procedure CRYPTO_zalloc()
    96.   }
    97.   
    98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:100:5: 
    98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100. >     void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
      69.   }
      70.   
      71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73.       void *ret = NULL;

crypto/mem.c:73:5: 
      71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73. >     void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
      73.       void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                    ^
      76.           return malloc_impl(num, file, line);
      77.   

crypto/mem.c:78:9: Taking false branch
      76.           return malloc_impl(num, file, line);
      77.   
      78.       if (num <= 0)
                    ^
      79.           return NULL;
      80.   

crypto/mem.c:81:5: 
      79.           return NULL;
      80.   
      81. >     allow_customize = 0;
      82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:91:24: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:92:5: 
      90.   #else
      91.       osslargused(file); osslargused(line);
      92. >     ret = malloc(num);
      93.   #endif
      94.   

crypto/mem.c:95:5: 
      93.   #endif
      94.   
      95. >     return ret;
      96.   }
      97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
      94.   
      95.       return ret;
      96. > }
      97.   
      98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:102:9: Taking true branch
    100.       void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)
                   ^
    103.           memset(ret, 0, num);
    104.       return ret;

crypto/mem.c:103:9: 
    101.   
    102.       if (ret != NULL)
    103. >         memset(ret, 0, num);
    104.       return ret;
    105.   }

crypto/mem.c:104:5: 
    102.       if (ret != NULL)
    103.           memset(ret, 0, num);
    104. >     return ret;
    105.   }
    106.   

crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
    103.           memset(ret, 0, num);
    104.       return ret;
    105. > }
    106.   
    107.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/init.c:44:9: 
  42.       if (local == NULL && alloc) {
  43.           local = OPENSSL_zalloc(sizeof *local);
  44. >         CRYPTO_THREAD_set_local(&threadstopkey, local);
  45.       }
  46.       if (!alloc) {

crypto/threads_pthread.c:84:1: start of procedure CRYPTO_THREAD_set_local()
    82.   }
    83.   
    84. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
    85.   {
    86.       if (pthread_setspecific(*key, val) != 0)

crypto/threads_pthread.c:86:9: Taking true branch
    84.   int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
    85.   {
    86.       if (pthread_setspecific(*key, val) != 0)
                  ^
    87.           return 0;
    88.   

crypto/threads_pthread.c:87:9: 
    85.   {
    86.       if (pthread_setspecific(*key, val) != 0)
    87. >         return 0;
    88.   
    89.       return 1;

crypto/threads_pthread.c:90:1: return from a call to CRYPTO_THREAD_set_local
    88.   
    89.       return 1;
    90. > }
    91.   
    92.   int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key)

crypto/init.c:46:10: Taking false branch
  44.           CRYPTO_THREAD_set_local(&threadstopkey, local);
  45.       }
  46.       if (!alloc) {
                 ^
  47.           CRYPTO_THREAD_set_local(&threadstopkey, NULL);
  48.       }

crypto/init.c:50:5: 
  48.       }
  49.   
  50. >     return local;
  51.   }
  52.   

crypto/init.c:51:1: return from a call to ossl_init_get_thread_local
  49.   
  50.       return local;
  51. > }
  52.   
  53.   typedef struct ossl_init_stop_st OPENSSL_INIT_STOP;

crypto/init.c:313:9: Taking false branch
311.       struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
312.   
313.       if (locals == NULL)
               ^
314.           return 0;
315.   

crypto/init.c:316:9: Taking false branch
314.           return 0;
315.   
316.       if (opts & OPENSSL_INIT_THREAD_ASYNC) {
               ^
317.   #ifdef OPENSSL_INIT_DEBUG
318.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "

crypto/init.c:324:9: Taking false branch
322.       }
323.   
324.       if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
               ^
325.   #ifdef OPENSSL_INIT_DEBUG
326.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
