test/threadstest.c:89: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_THREAD_lock_new()` at line 86, column 27 is not reachable after line 89, column 17.
Showing all 31 steps of the trace


test/threadstest.c:84:1: start of procedure test_lock()
82.   #endif
83.   
84. > static int test_lock(void)
85.   {
86.       CRYPTO_RWLOCK *lock = CRYPTO_THREAD_lock_new();

test/threadstest.c:86:5: 
84.   static int test_lock(void)
85.   {
86. >     CRYPTO_RWLOCK *lock = CRYPTO_THREAD_lock_new();
87.   
88.       if (!CRYPTO_THREAD_read_lock(lock)) {

crypto/threads_pthread.c:14:1: start of procedure CRYPTO_THREAD_lock_new()
  12.   #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && !defined(OPENSSL_SYS_WINDOWS)
  13.   
  14. > CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
  15.   {
  16.       CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));

crypto/threads_pthread.c:16:5: 
  14.   CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
  15.   {
  16. >     CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
  17.       if (lock == NULL)
  18.           return NULL;

crypto/mem.c:98:1: start of procedure CRYPTO_zalloc()
    96.   }
    97.   
    98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:100:5: 
    98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100. >     void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
      69.   }
      70.   
      71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73.       void *ret = NULL;

crypto/mem.c:73:5: 
      71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73. >     void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
      73.       void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                    ^
      76.           return malloc_impl(num, file, line);
      77.   

crypto/mem.c:78:9: Taking false branch
      76.           return malloc_impl(num, file, line);
      77.   
      78.       if (num <= 0)
                    ^
      79.           return NULL;
      80.   

crypto/mem.c:81:5: 
      79.           return NULL;
      80.   
      81. >     allow_customize = 0;
      82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:91:24: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:92:5: 
      90.   #else
      91.       osslargused(file); osslargused(line);
      92. >     ret = malloc(num);
      93.   #endif
      94.   

crypto/mem.c:95:5: 
      93.   #endif
      94.   
      95. >     return ret;
      96.   }
      97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
      94.   
      95.       return ret;
      96. > }
      97.   
      98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:102:9: Taking true branch
    100.       void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)
                   ^
    103.           memset(ret, 0, num);
    104.       return ret;

crypto/mem.c:103:9: 
    101.   
    102.       if (ret != NULL)
    103. >         memset(ret, 0, num);
    104.       return ret;
    105.   }

crypto/mem.c:104:5: 
    102.       if (ret != NULL)
    103.           memset(ret, 0, num);
    104. >     return ret;
    105.   }
    106.   

crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
    103.           memset(ret, 0, num);
    104.       return ret;
    105. > }
    106.   
    107.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/threads_pthread.c:17:9: Taking false branch
  15.   {
  16.       CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
  17.       if (lock == NULL)
                ^
  18.           return NULL;
  19.   

crypto/threads_pthread.c:20:9: Taking false branch
  18.           return NULL;
  19.   
  20.       if (pthread_rwlock_init(lock, NULL) != 0) {
                ^
  21.           OPENSSL_free(lock);
  22.           return NULL;

crypto/threads_pthread.c:25:5: 
  23.       }
  24.   
  25. >     return lock;
  26.   }
  27.   

crypto/threads_pthread.c:26:1: return from a call to CRYPTO_THREAD_lock_new
  24.   
  25.       return lock;
  26. > }
  27.   
  28.   int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)

test/threadstest.c:88:10: 
86.       CRYPTO_RWLOCK *lock = CRYPTO_THREAD_lock_new();
87.   
88. >     if (!CRYPTO_THREAD_read_lock(lock)) {
89.           fprintf(stderr, "CRYPTO_THREAD_read_lock() failed\n");
90.           return 0;

crypto/threads_pthread.c:28:1: start of procedure CRYPTO_THREAD_read_lock()
  26.   }
  27.   
  28. > int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)
  29.   {
  30.       if (pthread_rwlock_rdlock(lock) != 0)

crypto/threads_pthread.c:30:9: Taking true branch
  28.   int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)
  29.   {
  30.       if (pthread_rwlock_rdlock(lock) != 0)
                ^
  31.           return 0;
  32.   

crypto/threads_pthread.c:31:9: 
  29.   {
  30.       if (pthread_rwlock_rdlock(lock) != 0)
  31. >         return 0;
  32.   
  33.       return 1;

crypto/threads_pthread.c:34:1: return from a call to CRYPTO_THREAD_read_lock
  32.   
  33.       return 1;
  34. > }
  35.   
  36.   int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)

test/threadstest.c:88:10: Taking true branch
86.       CRYPTO_RWLOCK *lock = CRYPTO_THREAD_lock_new();
87.   
88.       if (!CRYPTO_THREAD_read_lock(lock)) {
               ^
89.           fprintf(stderr, "CRYPTO_THREAD_read_lock() failed\n");
90.           return 0;

test/threadstest.c:89:9: 
87.   
88.       if (!CRYPTO_THREAD_read_lock(lock)) {
89. >         fprintf(stderr, "CRYPTO_THREAD_read_lock() failed\n");
90.           return 0;
91.       }
