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


crypto/init.c:377:1: start of procedure ossl_init_thread_start()
375.   }
376.   
377. > int ossl_init_thread_start(uint64_t opts)
378.   {
379.       struct thread_local_inits_st *locals;

crypto/init.c:381:10: Taking false branch
379.       struct thread_local_inits_st *locals;
380.   
381.       if (!OPENSSL_init_crypto(0, NULL))
                ^
382.           return 0;
383.   

crypto/init.c:384:5: 
382.           return 0;
383.   
384. >     locals = ossl_init_get_thread_local(1);
385.   
386.       if (locals == NULL)

crypto/init.c:50:1: start of procedure ossl_init_get_thread_local()
  48.   }
  49.   
  50. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
  51.   {
  52.       struct thread_local_inits_st *local =

crypto/init.c:52:5: 
  50.   static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
  51.   {
  52. >     struct thread_local_inits_st *local =
  53.           CRYPTO_THREAD_get_local(&threadstopkey);
  54.   

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

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

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

crypto/init.c:55:9: Taking true branch
  53.           CRYPTO_THREAD_get_local(&threadstopkey);
  54.   
  55.       if (local == NULL && alloc) {
                ^
  56.           local = OPENSSL_zalloc(sizeof *local);
  57.           if (local != NULL && !CRYPTO_THREAD_set_local(&threadstopkey, local)) {

crypto/init.c:55:26: Taking true branch
  53.           CRYPTO_THREAD_get_local(&threadstopkey);
  54.   
  55.       if (local == NULL && alloc) {
                                 ^
  56.           local = OPENSSL_zalloc(sizeof *local);
  57.           if (local != NULL && !CRYPTO_THREAD_set_local(&threadstopkey, local)) {

crypto/init.c:56:9: 
  54.   
  55.       if (local == NULL && alloc) {
  56. >         local = OPENSSL_zalloc(sizeof *local);
  57.           if (local != NULL && !CRYPTO_THREAD_set_local(&threadstopkey, local)) {
  58.               OPENSSL_free(local);

crypto/mem.c:198:1: start of procedure CRYPTO_zalloc()
    196.   }
    197.   
    198. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    199.   {
    200.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:200:5: 
    198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    199.   {
    200. >     void *ret = CRYPTO_malloc(num, file, line);
    201.   
    202.       FAILTEST();

crypto/mem.c:170:1: start of procedure CRYPTO_malloc()
      168.   #endif
      169.   
      170. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      171.   {
      172.       void *ret = NULL;

crypto/mem.c:172:5: 
      170.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      171.   {
      172. >     void *ret = NULL;
      173.   
      174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:174:9: Taking false branch
      172.       void *ret = NULL;
      173.   
      174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      175.           return malloc_impl(num, file, line);
      176.   

crypto/mem.c:177:9: Taking false branch
      175.           return malloc_impl(num, file, line);
      176.   
      177.       if (num == 0)
                     ^
      178.           return NULL;
      179.   

crypto/mem.c:181:5: 
      179.   
      180.       FAILTEST();
      181. >     allow_customize = 0;
      182.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      183.       if (call_malloc_debug) {

crypto/mem.c:191:5: 
      189.       }
      190.   #else
      191. >     (void)(file); (void)(line);
      192.       ret = malloc(num);
      193.   #endif

crypto/mem.c:191:19: 
      189.       }
      190.   #else
      191. >     (void)(file); (void)(line);
      192.       ret = malloc(num);
      193.   #endif

crypto/mem.c:192:5: 
      190.   #else
      191.       (void)(file); (void)(line);
      192. >     ret = malloc(num);
      193.   #endif
      194.   

crypto/mem.c:195:5: 
      193.   #endif
      194.   
      195. >     return ret;
      196.   }
      197.   

crypto/mem.c:196:1: return from a call to CRYPTO_malloc
      194.   
      195.       return ret;
      196. > }
      197.   
      198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:203:9: Taking true branch
    201.   
    202.       FAILTEST();
    203.       if (ret != NULL)
                   ^
    204.           memset(ret, 0, num);
    205.       return ret;

crypto/mem.c:204:9: 
    202.       FAILTEST();
    203.       if (ret != NULL)
    204. >         memset(ret, 0, num);
    205.       return ret;
    206.   }

crypto/mem.c:205:5: 
    203.       if (ret != NULL)
    204.           memset(ret, 0, num);
    205. >     return ret;
    206.   }
    207.   

crypto/mem.c:206:1: return from a call to CRYPTO_zalloc
    204.           memset(ret, 0, num);
    205.       return ret;
    206. > }
    207.   
    208.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/init.c:57:13: Taking true branch
  55.       if (local == NULL && alloc) {
  56.           local = OPENSSL_zalloc(sizeof *local);
  57.           if (local != NULL && !CRYPTO_THREAD_set_local(&threadstopkey, local)) {
                    ^
  58.               OPENSSL_free(local);
  59.               return NULL;

crypto/init.c:57:31: 
  55.       if (local == NULL && alloc) {
  56.           local = OPENSSL_zalloc(sizeof *local);
  57. >         if (local != NULL && !CRYPTO_THREAD_set_local(&threadstopkey, local)) {
  58.               OPENSSL_free(local);
  59.               return NULL;

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

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

crypto/threads_pthread.c:131:5: 
    129.           return 0;
    130.   
    131. >     return 1;
    132.   }
    133.   

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

crypto/init.c:57:31: Taking false branch
  55.       if (local == NULL && alloc) {
  56.           local = OPENSSL_zalloc(sizeof *local);
  57.           if (local != NULL && !CRYPTO_THREAD_set_local(&threadstopkey, local)) {
                                      ^
  58.               OPENSSL_free(local);
  59.               return NULL;

crypto/init.c:62:10: Taking false branch
  60.           }
  61.       }
  62.       if (!alloc) {
                 ^
  63.           CRYPTO_THREAD_set_local(&threadstopkey, NULL);
  64.       }

crypto/init.c:66:5: 
  64.       }
  65.   
  66. >     return local;
  67.   }
  68.   

crypto/init.c:67:1: return from a call to ossl_init_get_thread_local
  65.   
  66.       return local;
  67. > }
  68.   
  69.   typedef struct ossl_init_stop_st OPENSSL_INIT_STOP;

crypto/init.c:386:9: Taking false branch
384.       locals = ossl_init_get_thread_local(1);
385.   
386.       if (locals == NULL)
               ^
387.           return 0;
388.   

crypto/init.c:389:9: Taking false branch
387.           return 0;
388.   
389.       if (opts & OPENSSL_INIT_THREAD_ASYNC) {
               ^
390.   #ifdef OPENSSL_INIT_DEBUG
391.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "

crypto/init.c:397:9: Taking false branch
395.       }
396.   
397.       if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
               ^
398.   #ifdef OPENSSL_INIT_DEBUG
399.           fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
