crypto/err/err.c:307: error: MEMORY_LEAK
  memory dynamically allocated to `err_string_lock` by call to `CRYPTO_THREAD_lock_new()` at line 300, column 23 is not reachable after line 307, column 9.
Showing all 45 steps of the trace


crypto/err/err.c:296:1: start of procedure do_err_strings_init()
294.   }
295.   
296. > DEFINE_RUN_ONCE_STATIC(do_err_strings_init)
297.   {
298.       if (!OPENSSL_init_crypto(0, NULL))

crypto/err/err.c:298:10: Taking false branch
296.   DEFINE_RUN_ONCE_STATIC(do_err_strings_init)
297.   {
298.       if (!OPENSSL_init_crypto(0, NULL))
                ^
299.           return 0;
300.       err_string_lock = CRYPTO_THREAD_lock_new();

crypto/err/err.c:300:5: 
298.       if (!OPENSSL_init_crypto(0, NULL))
299.           return 0;
300. >     err_string_lock = CRYPTO_THREAD_lock_new();
301.       if (err_string_lock == NULL)
302.           return 0;

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.   #if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)

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/err/err.c:301:9: Taking false branch
299.           return 0;
300.       err_string_lock = CRYPTO_THREAD_lock_new();
301.       if (err_string_lock == NULL)
               ^
302.           return 0;
303.       int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,

crypto/err/err.c:303:5: 
301.       if (err_string_lock == NULL)
302.           return 0;
303. >     int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
304.                                               err_string_data_cmp);
305.       if (int_error_hash == NULL) {

include/openssl/err.h:229:1: start of procedure lh_ERR_STRING_DATA_new()
  227.   } ERR_STRING_DATA;
  228.   
  229. > DEFINE_LHASH_OF(ERR_STRING_DATA);
  230.   
  231.   void ERR_put_error(int lib, int func, int reason, const char *file, int line);

include/openssl/err.h:229:1: return from a call to lh_ERR_STRING_DATA_new
  227.   } ERR_STRING_DATA;
  228.   
  229. > DEFINE_LHASH_OF(ERR_STRING_DATA);
  230.   
  231.   void ERR_put_error(int lib, int func, int reason, const char *file, int line);

crypto/err/err.c:305:9: Taking true branch
303.       int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
304.                                               err_string_data_cmp);
305.       if (int_error_hash == NULL) {
               ^
306.           CRYPTO_THREAD_lock_free(err_string_lock);
307.           err_string_lock = NULL;

crypto/err/err.c:306:9: 
304.                                               err_string_data_cmp);
305.       if (int_error_hash == NULL) {
306. >         CRYPTO_THREAD_lock_free(err_string_lock);
307.           err_string_lock = NULL;
308.           return 0;

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/err/err.c:307:9: 
305.       if (int_error_hash == NULL) {
306.           CRYPTO_THREAD_lock_free(err_string_lock);
307. >         err_string_lock = NULL;
308.           return 0;
309.       }
