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


crypto/init.c:363:1: start of procedure ossl_init_thread_start()
361.   }
362.   
363. > int ossl_init_thread_start(uint64_t opts)
364.   {
365.       struct thread_local_inits_st *locals;

crypto/init.c:367:10: Taking false branch
365.       struct thread_local_inits_st *locals;
366.   
367.       if (!OPENSSL_init_crypto(0, NULL))
                ^
368.           return 0;
369.   

crypto/init.c:370:5: 
368.           return 0;
369.   
370. >     locals = ossl_init_get_thread_local(1);
371.   
372.       if (locals == NULL)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/init.c:47:13: Taking true branch
  45.       if (local == NULL && alloc) {
  46.           local = OPENSSL_zalloc(sizeof *local);
  47.           if (local != NULL && !CRYPTO_THREAD_set_local(&threadstopkey, local)) {
                    ^
  48.               OPENSSL_free(local);
  49.               return NULL;

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

crypto/init.c:52:10: Taking false branch
  50.           }
  51.       }
  52.       if (!alloc) {
                 ^
  53.           CRYPTO_THREAD_set_local(&threadstopkey, NULL);
  54.       }

crypto/init.c:56:5: 
  54.       }
  55.   
  56. >     return local;
  57.   }
  58.   

crypto/init.c:57:1: return from a call to ossl_init_get_thread_local
  55.   
  56.       return local;
  57. > }
  58.   
  59.   typedef struct ossl_init_stop_st OPENSSL_INIT_STOP;

crypto/init.c:372:9: Taking false branch
370.       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 false 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: "
