crypto/init.c:102: error: MEMORY_LEAK
  memory dynamically allocated to `init_lock` by call to `CRYPTO_THREAD_lock_new()` at line 86, column 22 is not reachable after line 102, column 5.
Showing all 48 steps of the trace


crypto/init.c:72:1: start of procedure ossl_init_base()
70.   static CRYPTO_ONCE base = CRYPTO_ONCE_STATIC_INIT;
71.   static int base_inited = 0;
72. > DEFINE_RUN_ONCE_STATIC(ossl_init_base)
73.   {
74.   #ifdef OPENSSL_INIT_DEBUG

crypto/init.c:84:10: 
82.        * when the thread is going to stop (where that feature is available)
83.        */
84. >     if (!CRYPTO_THREAD_init_local(&threadstopkey, ossl_init_thread_stop_wrap))
85.           return 0;
86.       if ((init_lock = CRYPTO_THREAD_lock_new()) == NULL)

crypto/threads_pthread.c:119:1: start of procedure CRYPTO_THREAD_init_local()
  117.   }
  118.   
  119. > int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
  120.   {
  121.       if (pthread_key_create(key, cleanup) != 0)

crypto/threads_pthread.c:121:9: Taking false branch
  119.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
  120.   {
  121.       if (pthread_key_create(key, cleanup) != 0)
                 ^
  122.           return 0;
  123.   

crypto/threads_pthread.c:124:5: 
  122.           return 0;
  123.   
  124. >     return 1;
  125.   }
  126.   

crypto/threads_pthread.c:125:1: return from a call to CRYPTO_THREAD_init_local
  123.   
  124.       return 1;
  125. > }
  126.   
  127.   void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)

crypto/init.c:84:10: Taking false branch
82.        * when the thread is going to stop (where that feature is available)
83.        */
84.       if (!CRYPTO_THREAD_init_local(&threadstopkey, ossl_init_thread_stop_wrap))
               ^
85.           return 0;
86.       if ((init_lock = CRYPTO_THREAD_lock_new()) == NULL)

crypto/init.c:86:9: 
84.       if (!CRYPTO_THREAD_init_local(&threadstopkey, ossl_init_thread_stop_wrap))
85.           return 0;
86. >     if ((init_lock = CRYPTO_THREAD_lock_new()) == NULL)
87.           goto err;
88.   #ifndef OPENSSL_SYS_UEFI

crypto/threads_pthread.c:19:1: start of procedure CRYPTO_THREAD_lock_new()
  17.   # endif
  18.   
  19. > CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
  20.   {
  21.   # ifdef USE_RWLOCK

crypto/threads_pthread.c:24:9: 
  22.       CRYPTO_RWLOCK *lock;
  23.   
  24. >     if ((lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t))) == NULL) {
  25.           /* Don't set error, to avoid recursion blowup. */
  26.           return NULL;

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
    226.   }
    227.   
    228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230. >     void *ret = CRYPTO_malloc(num, file, line);
    231.   
    232.       FAILTEST();

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
      190.   #endif
      191.   
      192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194.       void *ret = NULL;

crypto/mem.c:194:5: 
      192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194. >     void *ret = NULL;
      195.   
      196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
      195.   
      196.       INCREMENT(malloc_count);
      197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      198.           return malloc_impl(num, file, line);
      199.   

crypto/mem.c:200:9: Taking false branch
      198.           return malloc_impl(num, file, line);
      199.   
      200.       if (num == 0)
                     ^
      201.           return NULL;
      202.   

crypto/mem.c:204:9: Taking true branch
      202.   
      203.       FAILTEST();
      204.       if (allow_customize) {
                     ^
      205.           /*
      206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
      208.            * allocation.
      209.            */
      210. >         allow_customize = 0;
      211.       }
      212.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:221:5: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:221:19: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:222:5: 
      220.   #else
      221.       (void)(file); (void)(line);
      222. >     ret = malloc(num);
      223.   #endif
      224.   

crypto/mem.c:225:5: 
      223.   #endif
      224.   
      225. >     return ret;
      226.   }
      227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
      224.   
      225.       return ret;
      226. > }
      227.   
      228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking true branch
    231.   
    232.       FAILTEST();
    233.       if (ret != NULL)
                   ^
    234.           memset(ret, 0, num);
    235.       return ret;

crypto/mem.c:234:9: 
    232.       FAILTEST();
    233.       if (ret != NULL)
    234. >         memset(ret, 0, num);
    235.       return ret;
    236.   }

crypto/mem.c:235:5: 
    233.       if (ret != NULL)
    234.           memset(ret, 0, num);
    235. >     return ret;
    236.   }
    237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
    234.           memset(ret, 0, num);
    235.       return ret;
    236. > }
    237.   
    238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/threads_pthread.c:24:9: Taking false branch
  22.       CRYPTO_RWLOCK *lock;
  23.   
  24.       if ((lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t))) == NULL) {
                ^
  25.           /* Don't set error, to avoid recursion blowup. */
  26.           return NULL;

crypto/threads_pthread.c:29:9: Taking false branch
  27.       }
  28.   
  29.       if (pthread_rwlock_init(lock, NULL) != 0) {
                ^
  30.           OPENSSL_free(lock);
  31.           return NULL;

crypto/threads_pthread.c:54:5: 
  52.   # endif
  53.   
  54. >     return lock;
  55.   }
  56.   

crypto/threads_pthread.c:55:1: return from a call to CRYPTO_THREAD_lock_new
  53.   
  54.       return lock;
  55. > }
  56.   
  57.   int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)

crypto/init.c:86:9: Taking false branch
84.       if (!CRYPTO_THREAD_init_local(&threadstopkey, ossl_init_thread_stop_wrap))
85.           return 0;
86.       if ((init_lock = CRYPTO_THREAD_lock_new()) == NULL)
              ^
87.           goto err;
88.   #ifndef OPENSSL_SYS_UEFI

crypto/init.c:89:9: Taking true branch
87.           goto err;
88.   #ifndef OPENSSL_SYS_UEFI
89.       if (atexit(OPENSSL_cleanup) != 0)
              ^
90.           goto err;
91.   #endif

crypto/init.c:97:1: 
95.       return 1;
96.   
97. > err:
98.   #ifdef OPENSSL_INIT_DEBUG
99.       fprintf(stderr, "OPENSSL_INIT: ossl_init_base not ok!\n");

crypto/init.c:101:5: 
99.       fprintf(stderr, "OPENSSL_INIT: ossl_init_base not ok!\n");
100.   #endif
101. >     CRYPTO_THREAD_lock_free(init_lock);
102.       init_lock = NULL;
103.   

crypto/threads_pthread.c:96:1: start of procedure CRYPTO_THREAD_lock_free()
  94.   }
  95.   
  96. > void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock)
  97.   {
  98.       if (lock == NULL)

crypto/threads_pthread.c:98:9: Taking false branch
  96.   void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock)
  97.   {
  98.       if (lock == NULL)
                 ^
  99.           return;
  100.   

crypto/threads_pthread.c:102:5: Skipping pthread_rwlock_destroy(): method has no implementation
  100.   
  101.   # ifdef USE_RWLOCK
  102.       pthread_rwlock_destroy(lock);
             ^
  103.   # else
  104.       pthread_mutex_destroy(lock);

crypto/threads_pthread.c:106:5: 
  104.       pthread_mutex_destroy(lock);
  105.   # endif
  106. >     OPENSSL_free(lock);
  107.   
  108.       return;

crypto/mem.c:295:1: start of procedure CRYPTO_free()
    293.   }
    294.   
    295. > void CRYPTO_free(void *str, const char *file, int line)
    296.   {
    297.       INCREMENT(free_count);

crypto/mem.c:298:9: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:298:30: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
                   ^
    300.           return;
    301.       }

crypto/mem.c:300:9: 
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
    300. >         return;
    301.       }
    302.   

crypto/mem.c:314:1: return from a call to CRYPTO_free
    312.       free(str);
    313.   #endif
    314. > }
    315.   
    316.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/threads_pthread.c:108:5: 
  106.       OPENSSL_free(lock);
  107.   
  108. >     return;
  109.   }
  110.   

crypto/threads_pthread.c:109:1: return from a call to CRYPTO_THREAD_lock_free
  107.   
  108.       return;
  109. > }
  110.   
  111.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))

crypto/init.c:102:5: 
100.   #endif
101.       CRYPTO_THREAD_lock_free(init_lock);
102. >     init_lock = NULL;
103.   
104.       CRYPTO_THREAD_cleanup_local(&threadstopkey);
