ssl/ssl_sess.c:103: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_THREAD_lock_new()` at line 94, column 16 is not reachable after line 103, column 9.
Showing all 86 steps of the trace


ssl/ssl_sess.c:80:1: start of procedure SSL_SESSION_new()
78.   }
79.   
80. > SSL_SESSION *SSL_SESSION_new(void)
81.   {
82.       SSL_SESSION *ss;

ssl/ssl_sess.c:84:5: 
82.       SSL_SESSION *ss;
83.   
84. >     ss = OPENSSL_zalloc(sizeof(*ss));
85.       if (ss == NULL) {
86.           SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE);

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)

ssl/ssl_sess.c:85:9: Taking false branch
83.   
84.       ss = OPENSSL_zalloc(sizeof(*ss));
85.       if (ss == NULL) {
              ^
86.           SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE);
87.           return NULL;

ssl/ssl_sess.c:90:5: 
88.       }
89.   
90. >     ss->verify_result = 1;      /* avoid 0 (= X509_V_OK) just in case */
91.       ss->references = 1;
92.       ss->timeout = 60 * 5 + 4;   /* 5 minute timeout by default */

ssl/ssl_sess.c:91:5: 
89.   
90.       ss->verify_result = 1;      /* avoid 0 (= X509_V_OK) just in case */
91. >     ss->references = 1;
92.       ss->timeout = 60 * 5 + 4;   /* 5 minute timeout by default */
93.       ss->time = (unsigned long)time(NULL);

ssl/ssl_sess.c:92:5: 
90.       ss->verify_result = 1;      /* avoid 0 (= X509_V_OK) just in case */
91.       ss->references = 1;
92. >     ss->timeout = 60 * 5 + 4;   /* 5 minute timeout by default */
93.       ss->time = (unsigned long)time(NULL);
94.       ss->lock = CRYPTO_THREAD_lock_new();

ssl/ssl_sess.c:93:5: 
91.       ss->references = 1;
92.       ss->timeout = 60 * 5 + 4;   /* 5 minute timeout by default */
93. >     ss->time = (unsigned long)time(NULL);
94.       ss->lock = CRYPTO_THREAD_lock_new();
95.       if (ss->lock == NULL) {

ssl/ssl_sess.c:94:5: 
92.       ss->timeout = 60 * 5 + 4;   /* 5 minute timeout by default */
93.       ss->time = (unsigned long)time(NULL);
94. >     ss->lock = CRYPTO_THREAD_lock_new();
95.       if (ss->lock == NULL) {
96.           SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE);

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: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/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)

ssl/ssl_sess.c:95:9: Taking false branch
93.       ss->time = (unsigned long)time(NULL);
94.       ss->lock = CRYPTO_THREAD_lock_new();
95.       if (ss->lock == NULL) {
              ^
96.           SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE);
97.           OPENSSL_free(ss);

ssl/ssl_sess.c:101:10: 
99.       }
100.   
101. >     if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data)) {
102.           CRYPTO_THREAD_lock_free(ss->lock);
103.           OPENSSL_free(ss);

crypto/ex_data.c:208:1: start of procedure CRYPTO_new_ex_data()
  206.    * to the global "ex_data" state (ie. class definitions), not 'ad' itself.
  207.    */
  208. > int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
  209.   {
  210.       int mx, i;

crypto/ex_data.c:212:5: 
  210.       int mx, i;
  211.       void *ptr;
  212. >     EX_CALLBACK **storage = NULL;
  213.       EX_CALLBACK *stack[10];
  214.       EX_CALLBACKS *ip = get_and_lock(class_index);

crypto/ex_data.c:214:5: 
  212.       EX_CALLBACK **storage = NULL;
  213.       EX_CALLBACK *stack[10];
  214. >     EX_CALLBACKS *ip = get_and_lock(class_index);
  215.   
  216.       if (ip == NULL)

crypto/ex_data.c:50:1: start of procedure get_and_lock()
    48.    * a given class.  On success, *holds the lock.*
    49.    */
    50. > static EX_CALLBACKS *get_and_lock(int class_index)
    51.   {
    52.       EX_CALLBACKS *ip;

crypto/ex_data.c:54:9: Taking false branch
    52.       EX_CALLBACKS *ip;
    53.   
    54.       if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
                  ^
    55.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_PASSED_INVALID_ARGUMENT);
    56.           return NULL;

crypto/ex_data.c:54:28: Taking false branch
    52.       EX_CALLBACKS *ip;
    53.   
    54.       if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
                                     ^
    55.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_PASSED_INVALID_ARGUMENT);
    56.           return NULL;

crypto/ex_data.c:59:10: 
    57.       }
    58.   
    59. >     if (!RUN_ONCE(&ex_data_init, do_ex_data_init)) {
    60.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_MALLOC_FAILURE);
    61.           return NULL;

crypto/threads_pthread.c:63:1: start of procedure CRYPTO_THREAD_run_once()
      61.   }
      62.   
      63. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
      64.   {
      65.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:65:9: Taking true branch
      63.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
      64.   {
      65.       if (pthread_once(once, init) != 0)
                    ^
      66.           return 0;
      67.   

crypto/threads_pthread.c:66:9: 
      64.   {
      65.       if (pthread_once(once, init) != 0)
      66. >         return 0;
      67.   
      68.       return 1;

crypto/threads_pthread.c:69:1: return from a call to CRYPTO_THREAD_run_once
      67.   
      68.       return 1;
      69. > }
      70.   
      71.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/ex_data.c:59:10: Condition is false
    57.       }
    58.   
    59.       if (!RUN_ONCE(&ex_data_init, do_ex_data_init)) {
                   ^
    60.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_MALLOC_FAILURE);
    61.           return NULL;

crypto/ex_data.c:59:10: Taking true branch
    57.       }
    58.   
    59.       if (!RUN_ONCE(&ex_data_init, do_ex_data_init)) {
                   ^
    60.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_MALLOC_FAILURE);
    61.           return NULL;

crypto/ex_data.c:60:9: Skipping ERR_put_error(): empty list of specs
    58.   
    59.       if (!RUN_ONCE(&ex_data_init, do_ex_data_init)) {
    60.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_MALLOC_FAILURE);
                  ^
    61.           return NULL;
    62.       }

crypto/ex_data.c:61:9: 
    59.       if (!RUN_ONCE(&ex_data_init, do_ex_data_init)) {
    60.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_MALLOC_FAILURE);
    61. >         return NULL;
    62.       }
    63.   

crypto/ex_data.c:80:1: return from a call to get_and_lock
    78.       CRYPTO_THREAD_write_lock(ex_data_lock);
    79.       return ip;
    80. > }
    81.   
    82.   static void cleanup_cb(EX_CALLBACK *funcs)

crypto/ex_data.c:216:9: Taking true branch
  214.       EX_CALLBACKS *ip = get_and_lock(class_index);
  215.   
  216.       if (ip == NULL)
                 ^
  217.           return 0;
  218.   

crypto/ex_data.c:217:9: 
  215.   
  216.       if (ip == NULL)
  217. >         return 0;
  218.   
  219.       ad->sk = NULL;

crypto/ex_data.c:247:1: return from a call to CRYPTO_new_ex_data
  245.           OPENSSL_free(storage);
  246.       return 1;
  247. > }
  248.   
  249.   /*

ssl/ssl_sess.c:101:10: Taking true branch
99.       }
100.   
101.       if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data)) {
                ^
102.           CRYPTO_THREAD_lock_free(ss->lock);
103.           OPENSSL_free(ss);

ssl/ssl_sess.c:102:9: 
100.   
101.       if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data)) {
102. >         CRYPTO_THREAD_lock_free(ss->lock);
103.           OPENSSL_free(ss);
104.           return NULL;

crypto/threads_pthread.c:52:1: start of procedure CRYPTO_THREAD_lock_free()
  50.   }
  51.   
  52. > void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock)
  53.   {
  54.       if (lock == NULL)

crypto/threads_pthread.c:54:9: Taking false branch
  52.   void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock)
  53.   {
  54.       if (lock == NULL)
                ^
  55.           return;
  56.   

crypto/threads_pthread.c:57:5: Skipping pthread_rwlock_destroy(): method has no implementation
  55.           return;
  56.   
  57.       pthread_rwlock_destroy(lock);
            ^
  58.       OPENSSL_free(lock);
  59.   

crypto/threads_pthread.c:58:5: 
  56.   
  57.       pthread_rwlock_destroy(lock);
  58. >     OPENSSL_free(lock);
  59.   
  60.       return;

crypto/mem.c:252:1: start of procedure CRYPTO_free()
    250.   }
    251.   
    252. > void CRYPTO_free(void *str, const char *file, int line)
    253.   {
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:254:9: Taking true branch
    252.   void CRYPTO_free(void *str, const char *file, int line)
    253.   {
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    255.           free_impl(str, file, line);
    256.           return;

crypto/mem.c:254:30: Taking true branch
    252.   void CRYPTO_free(void *str, const char *file, int line)
    253.   {
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    255.           free_impl(str, file, line);
    256.           return;

crypto/mem.c:255:9: Skipping __function_pointer__(): unresolved function pointer
    253.   {
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    255.           free_impl(str, file, line);
                   ^
    256.           return;
    257.       }

crypto/mem.c:256:9: 
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    255.           free_impl(str, file, line);
    256. >         return;
    257.       }
    258.   

crypto/mem.c:270:1: return from a call to CRYPTO_free
    268.       free(str);
    269.   #endif
    270. > }
    271.   
    272.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/threads_pthread.c:60:5: 
  58.       OPENSSL_free(lock);
  59.   
  60. >     return;
  61.   }
  62.   

crypto/threads_pthread.c:61:1: return from a call to CRYPTO_THREAD_lock_free
  59.   
  60.       return;
  61. > }
  62.   
  63.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))

ssl/ssl_sess.c:103:9: 
101.       if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data)) {
102.           CRYPTO_THREAD_lock_free(ss->lock);
103. >         OPENSSL_free(ss);
104.           return NULL;
105.       }

crypto/mem.c:252:1: start of procedure CRYPTO_free()
  250.   }
  251.   
  252. > void CRYPTO_free(void *str, const char *file, int line)
  253.   {
  254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:254:9: Taking false branch
  252.   void CRYPTO_free(void *str, const char *file, int line)
  253.   {
  254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                 ^
  255.           free_impl(str, file, line);
  256.           return;

crypto/mem.c:268:5: 
  266.       }
  267.   #else
  268. >     free(str);
  269.   #endif
  270.   }

crypto/mem.c:270:1: return from a call to CRYPTO_free
  268.       free(str);
  269.   #endif
  270. > }
  271.   
  272.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
