test/threadstest.c:88: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_THREAD_lock_new()` at line 86, column 27 is not reachable after line 88, column 10.
Showing all 54 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 (!TEST_true(CRYPTO_THREAD_read_lock(lock))

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

crypto/threads_pthread.c:21:5: 
  19.   {
  20.   # ifdef USE_RWLOCK
  21. >     CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
  22.       if (lock == NULL)
  23.           return NULL;

crypto/mem.c:186:1: start of procedure CRYPTO_zalloc()
    184.   }
    185.   
    186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188.       void *ret = CRYPTO_malloc(num, file, line);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/threads_pthread.c:22:9: Taking false branch
  20.   # ifdef USE_RWLOCK
  21.       CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
  22.       if (lock == NULL)
                ^
  23.           return NULL;
  24.   

crypto/threads_pthread.c:25:9: Taking false branch
  23.           return NULL;
  24.   
  25.       if (pthread_rwlock_init(lock, NULL) != 0) {
                ^
  26.           OPENSSL_free(lock);
  27.           return NULL;

crypto/threads_pthread.c:47:5: 
  45.   # endif
  46.   
  47. >     return lock;
  48.   }
  49.   

crypto/threads_pthread.c:48:1: return from a call to CRYPTO_THREAD_lock_new
  46.   
  47.       return lock;
  48. > }
  49.   
  50.   int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)

test/threadstest.c:88:10: 
86.       CRYPTO_RWLOCK *lock = CRYPTO_THREAD_lock_new();
87.   
88. >     if (!TEST_true(CRYPTO_THREAD_read_lock(lock))
89.           || !TEST_true(CRYPTO_THREAD_unlock(lock)))
90.           return 0;

crypto/threads_pthread.c:50:1: start of procedure CRYPTO_THREAD_read_lock()
  48.   }
  49.   
  50. > int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)
  51.   {
  52.   # ifdef USE_RWLOCK

crypto/threads_pthread.c:53:9: Taking true branch
  51.   {
  52.   # ifdef USE_RWLOCK
  53.       if (pthread_rwlock_rdlock(lock) != 0)
                ^
  54.           return 0;
  55.   # else

crypto/threads_pthread.c:54:9: 
  52.   # ifdef USE_RWLOCK
  53.       if (pthread_rwlock_rdlock(lock) != 0)
  54. >         return 0;
  55.   # else
  56.       if (pthread_mutex_lock(lock) != 0)

crypto/threads_pthread.c:61:1: return from a call to CRYPTO_THREAD_read_lock
  59.   
  60.       return 1;
  61. > }
  62.   
  63.   int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)

test/threadstest.c:88:10: Condition is false
86.       CRYPTO_RWLOCK *lock = CRYPTO_THREAD_lock_new();
87.   
88.       if (!TEST_true(CRYPTO_THREAD_read_lock(lock))
               ^
89.           || !TEST_true(CRYPTO_THREAD_unlock(lock)))
90.           return 0;

test/testutil.c:317:1: start of procedure test_true()
  315.   }
  316.   
  317. > int test_true(const char *file, int line, const char *s, int b)
  318.   {
  319.       if (b)

test/testutil.c:319:9: Taking false branch
  317.   int test_true(const char *file, int line, const char *s, int b)
  318.   {
  319.       if (b)
                 ^
  320.           return 1;
  321.       test_fail_message(NULL, file, line, "bool", "%s [false] == true", s);

test/testutil.c:321:5: 
  319.       if (b)
  320.           return 1;
  321. >     test_fail_message(NULL, file, line, "bool", "%s [false] == true", s);
  322.       return 0;
  323.   }

test/testutil.c:202:1: start of procedure test_fail_message()
    200.   }
    201.   
    202. > static void test_fail_message(const char *prefix, const char *file, int line,
    203.                                 const char *type, const char *fmt, ...)
    204.   {

test/testutil.c:206:5: 
    204.   {
    205.       va_list ap;
    206. >     va_start(ap, fmt);
    207.       test_fail_message_va(prefix, file, line, type, fmt, ap);
    208.       va_end(ap);

test/testutil.c:207:5: 
    205.       va_list ap;
    206.       va_start(ap, fmt);
    207. >     test_fail_message_va(prefix, file, line, type, fmt, ap);
    208.       va_end(ap);
    209.   }

test/testutil.c:185:1: start of procedure test_fail_message_va()
      183.               PRINTF_FORMAT(5, 6);
      184.   
      185. > static void test_fail_message_va(const char *prefix, const char *file, int line,
      186.                                    const char *type, const char *fmt, va_list ap)
      187.   {

test/testutil.c:188:11: Condition is false
      186.                                    const char *type, const char *fmt, va_list ap)
      187.   {
      188.       fputs(prefix != NULL ? prefix : "ERROR", stderr);
                       ^
      189.       fputs(":", stderr);
      190.       if (type)

test/testutil.c:188:5: 
      186.                                    const char *type, const char *fmt, va_list ap)
      187.   {
      188. >     fputs(prefix != NULL ? prefix : "ERROR", stderr);
      189.       fputs(":", stderr);
      190.       if (type)

test/testutil.c:189:5: 
      187.   {
      188.       fputs(prefix != NULL ? prefix : "ERROR", stderr);
      189. >     fputs(":", stderr);
      190.       if (type)
      191.           fprintf(stderr, " (%s)", type);

test/testutil.c:190:9: Taking true branch
      188.       fputs(prefix != NULL ? prefix : "ERROR", stderr);
      189.       fputs(":", stderr);
      190.       if (type)
                     ^
      191.           fprintf(stderr, " (%s)", type);
      192.       if (fmt != NULL) {

test/testutil.c:191:9: 
      189.       fputs(":", stderr);
      190.       if (type)
      191. >         fprintf(stderr, " (%s)", type);
      192.       if (fmt != NULL) {
      193.           fputc(' ', stderr);

test/testutil.c:192:9: Taking true branch
      190.       if (type)
      191.           fprintf(stderr, " (%s)", type);
      192.       if (fmt != NULL) {
                     ^
      193.           fputc(' ', stderr);
      194.           vfprintf(stderr, fmt, ap);

test/testutil.c:193:9: 
      191.           fprintf(stderr, " (%s)", type);
      192.       if (fmt != NULL) {
      193. >         fputc(' ', stderr);
      194.           vfprintf(stderr, fmt, ap);
      195.       }

test/testutil.c:194:9: 
      192.       if (fmt != NULL) {
      193.           fputc(' ', stderr);
      194. >         vfprintf(stderr, fmt, ap);
      195.       }
      196.       if (file != NULL) {

test/testutil.c:196:9: Taking true branch
      194.           vfprintf(stderr, fmt, ap);
      195.       }
      196.       if (file != NULL) {
                     ^
      197.           fprintf(stderr, " @ %s:%d", file, line);
      198.       }

test/testutil.c:197:9: 
      195.       }
      196.       if (file != NULL) {
      197. >         fprintf(stderr, " @ %s:%d", file, line);
      198.       }
      199.       fputc('\n', stderr);

test/testutil.c:199:5: 
      197.           fprintf(stderr, " @ %s:%d", file, line);
      198.       }
      199. >     fputc('\n', stderr);
      200.   }
      201.   

test/testutil.c:200:1: return from a call to test_fail_message_va
      198.       }
      199.       fputc('\n', stderr);
      200. > }
      201.   
      202.   static void test_fail_message(const char *prefix, const char *file, int line,

test/testutil.c:208:5: 
    206.       va_start(ap, fmt);
    207.       test_fail_message_va(prefix, file, line, type, fmt, ap);
    208. >     va_end(ap);
    209.   }
    210.   

test/testutil.c:209:1: return from a call to test_fail_message
    207.       test_fail_message_va(prefix, file, line, type, fmt, ap);
    208.       va_end(ap);
    209. > }
    210.   
    211.   void test_info_c90(const char *desc, ...)

test/testutil.c:322:5: 
  320.           return 1;
  321.       test_fail_message(NULL, file, line, "bool", "%s [false] == true", s);
  322. >     return 0;
  323.   }
  324.   

test/testutil.c:323:1: return from a call to test_true
  321.       test_fail_message(NULL, file, line, "bool", "%s [false] == true", s);
  322.       return 0;
  323. > }
  324.   
  325.   int test_false(const char *file, int line, const char *s, int b)

test/threadstest.c:88:10: Taking true branch
86.       CRYPTO_RWLOCK *lock = CRYPTO_THREAD_lock_new();
87.   
88.       if (!TEST_true(CRYPTO_THREAD_read_lock(lock))
               ^
89.           || !TEST_true(CRYPTO_THREAD_unlock(lock)))
90.           return 0;
