crypto/init.c:373: error: MEMORY_LEAK
  memory dynamically allocated to `locals` by call to `ossl_init_get_thread_local()` at line 360, column 44 is not reachable after line 373, column 9.
Showing all 37 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: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: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:185:1: start of procedure CRYPTO_zalloc()
    183.   }
    184.   
    185. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    186.   {
    187.       void *ret = CRYPTO_malloc(num, file, line);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/mem.c:193:1: return from a call to CRYPTO_zalloc
    191.           memset(ret, 0, num);
    192.       return ret;
    193. > }
    194.   
    195.   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: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: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 false 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: "
