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


crypto/init.c:358:1: start of procedure ossl_init_thread_start()
356.   }
357.   
358. > int ossl_init_thread_start(uint64_t opts)
359.   {
360.       struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);

crypto/init.c:360:5: 
358.   int ossl_init_thread_start(uint64_t opts)
359.   {
360. >     struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
361.   
362.       if (locals == NULL)

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

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

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:44:9: Taking true branch
  42.           CRYPTO_THREAD_get_local(&threadstopkey);
  43.   
  44.       if (local == NULL && alloc) {
                ^
  45.           local = OPENSSL_zalloc(sizeof *local);
  46.           CRYPTO_THREAD_set_local(&threadstopkey, local);

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

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

crypto/mem.c:186:1: start of procedure CRYPTO_zalloc()
    184.   }
    185.   
    186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:188:5: 
    186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188. >     void *ret = CRYPTO_malloc(num, file, line);
    189.   
    190.       FAILTEST();

crypto/mem.c:158:1: start of procedure CRYPTO_malloc()
      156.   #endif
      157.   
      158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      159.   {
      160.       void *ret = NULL;

crypto/mem.c:160:5: 
      158.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      159.   {
      160. >     void *ret = NULL;
      161.   
      162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:162:9: Taking false branch
      160.       void *ret = NULL;
      161.   
      162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      163.           return malloc_impl(num, file, line);
      164.   

crypto/mem.c:165:9: Taking false branch
      163.           return malloc_impl(num, file, line);
      164.   
      165.       if (num == 0)
                     ^
      166.           return NULL;
      167.   

crypto/mem.c:169:5: 
      167.   
      168.       FAILTEST();
      169. >     allow_customize = 0;
      170.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      171.       if (call_malloc_debug) {

crypto/mem.c:179:5: 
      177.       }
      178.   #else
      179. >     osslargused(file); osslargused(line);
      180.       ret = malloc(num);
      181.   #endif

crypto/mem.c:179:24: 
      177.       }
      178.   #else
      179. >     osslargused(file); osslargused(line);
      180.       ret = malloc(num);
      181.   #endif

crypto/mem.c:180:5: 
      178.   #else
      179.       osslargused(file); osslargused(line);
      180. >     ret = malloc(num);
      181.   #endif
      182.   

crypto/mem.c:183:5: 
      181.   #endif
      182.   
      183. >     return ret;
      184.   }
      185.   

crypto/mem.c:184:1: return from a call to CRYPTO_malloc
      182.   
      183.       return ret;
      184. > }
      185.   
      186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:191:9: Taking true branch
    189.   
    190.       FAILTEST();
    191.       if (ret != NULL)
                   ^
    192.           memset(ret, 0, num);
    193.       return ret;

crypto/mem.c:192:9: 
    190.       FAILTEST();
    191.       if (ret != NULL)
    192. >         memset(ret, 0, num);
    193.       return ret;
    194.   }

crypto/mem.c:193:5: 
    191.       if (ret != NULL)
    192.           memset(ret, 0, num);
    193. >     return ret;
    194.   }
    195.   

crypto/mem.c:194:1: return from a call to CRYPTO_zalloc
    192.           memset(ret, 0, num);
    193.       return ret;
    194. > }
    195.   
    196.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/init.c:46:9: 
  44.       if (local == NULL && alloc) {
  45.           local = OPENSSL_zalloc(sizeof *local);
  46. >         CRYPTO_THREAD_set_local(&threadstopkey, local);
  47.       }
  48.       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:48:10: Taking false branch
  46.           CRYPTO_THREAD_set_local(&threadstopkey, local);
  47.       }
  48.       if (!alloc) {
                 ^
  49.           CRYPTO_THREAD_set_local(&threadstopkey, NULL);
  50.       }

crypto/init.c:52:5: 
  50.       }
  51.   
  52. >     return local;
  53.   }
  54.   

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

crypto/init.c:362:9: Taking false branch
360.       struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
361.   
362.       if (locals == NULL)
               ^
363.           return 0;
364.   

crypto/init.c:365:9: Taking false branch
363.           return 0;
364.   
365.       if (opts & OPENSSL_INIT_THREAD_ASYNC) {
               ^
366.   #ifdef OPENSSL_INIT_DEBUG
367.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "

crypto/init.c:373:9: Taking true branch
371.       }
372.   
373.       if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
               ^
374.   #ifdef OPENSSL_INIT_DEBUG
375.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "

crypto/init.c:378:9: 
376.                           "marking thread for err_state\n");
377.   #endif
378. >         locals->err_state = 1;
379.       }
380.   
