ssl/bio_ssl.c:524: error: MEMORY_LEAK
  memory dynamically allocated by call to `BIO_new()` at line 516, column 16 is not reachable after line 524, column 5.
Showing all 81 steps of the trace


ssl/bio_ssl.c:511:1: start of procedure BIO_new_ssl_connect()
509.   }
510.   
511. > BIO *BIO_new_ssl_connect(SSL_CTX *ctx)
512.   {
513.   #ifndef OPENSSL_NO_SOCK

ssl/bio_ssl.c:514:5: 
512.   {
513.   #ifndef OPENSSL_NO_SOCK
514. >     BIO *ret = NULL, *con = NULL, *ssl = NULL;
515.   
516.       if ((con = BIO_new(BIO_s_connect())) == NULL)

ssl/bio_ssl.c:516:9: 
514.       BIO *ret = NULL, *con = NULL, *ssl = NULL;
515.   
516. >     if ((con = BIO_new(BIO_s_connect())) == NULL)
517.           return (NULL);
518.       if ((ssl = BIO_new_ssl(ctx, 1)) == NULL)

crypto/bio/bss_conn.c:307:1: start of procedure BIO_s_connect()
  305.   }
  306.   
  307. > BIO_METHOD *BIO_s_connect(void)
  308.   {
  309.       return (&methods_connectp);

crypto/bio/bss_conn.c:309:5: 
  307.   BIO_METHOD *BIO_s_connect(void)
  308.   {
  309. >     return (&methods_connectp);
  310.   }
  311.   

crypto/bio/bss_conn.c:310:1: return from a call to BIO_s_connect
  308.   {
  309.       return (&methods_connectp);
  310. > }
  311.   
  312.   static int conn_new(BIO *bi)

crypto/bio/bio_lib.c:65:1: start of procedure BIO_new()
  63.   #include <openssl/stack.h>
  64.   
  65. > BIO *BIO_new(BIO_METHOD *method)
  66.   {
  67.       BIO *ret = OPENSSL_malloc(sizeof(*ret));

crypto/bio/bio_lib.c:67:5: 
  65.   BIO *BIO_new(BIO_METHOD *method)
  66.   {
  67. >     BIO *ret = OPENSSL_malloc(sizeof(*ret));
  68.   
  69.       if (ret == NULL) {

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
    117.   }
    118.   
    119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    120.   {
    121.       void *ret = NULL;

crypto/mem.c:121:5: 
    119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    120.   {
    121. >     void *ret = NULL;
    122.   
    123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
    121.       void *ret = NULL;
    122.   
    123.       if (num <= 0)
                   ^
    124.           return NULL;
    125.   

crypto/mem.c:126:5: 
    124.           return NULL;
    125.   
    126. >     allow_customize = 0;
    127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
    134.       }
    135.   #else
    136. >     (void)file;
    137.       (void)line;
    138.       ret = malloc(num);

crypto/mem.c:137:5: 
    135.   #else
    136.       (void)file;
    137. >     (void)line;
    138.       ret = malloc(num);
    139.   #endif

crypto/mem.c:138:5: 
    136.       (void)file;
    137.       (void)line;
    138. >     ret = malloc(num);
    139.   #endif
    140.   

crypto/mem.c:153:5: 
    151.   #endif
    152.   
    153. >     return ret;
    154.   }
    155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
    152.   
    153.       return ret;
    154. > }
    155.   
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/bio/bio_lib.c:69:9: Taking false branch
  67.       BIO *ret = OPENSSL_malloc(sizeof(*ret));
  68.   
  69.       if (ret == NULL) {
                ^
  70.           BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE);
  71.           return (NULL);

crypto/bio/bio_lib.c:73:10: Taking false branch
  71.           return (NULL);
  72.       }
  73.       if (!BIO_set(ret, method)) {
                 ^
  74.           OPENSSL_free(ret);
  75.           ret = NULL;

crypto/bio/bio_lib.c:77:5: 
  75.           ret = NULL;
  76.       }
  77. >     return (ret);
  78.   }
  79.   

crypto/bio/bio_lib.c:78:1: return from a call to BIO_new
  76.       }
  77.       return (ret);
  78. > }
  79.   
  80.   int BIO_set(BIO *bio, BIO_METHOD *method)

ssl/bio_ssl.c:516:9: Taking false branch
514.       BIO *ret = NULL, *con = NULL, *ssl = NULL;
515.   
516.       if ((con = BIO_new(BIO_s_connect())) == NULL)
               ^
517.           return (NULL);
518.       if ((ssl = BIO_new_ssl(ctx, 1)) == NULL)

ssl/bio_ssl.c:518:9: 
516.       if ((con = BIO_new(BIO_s_connect())) == NULL)
517.           return (NULL);
518. >     if ((ssl = BIO_new_ssl(ctx, 1)) == NULL)
519.           goto err;
520.       if ((ret = BIO_push(ssl, con)) == NULL)

ssl/bio_ssl.c:529:1: start of procedure BIO_new_ssl()
  527.   }
  528.   
  529. > BIO *BIO_new_ssl(SSL_CTX *ctx, int client)
  530.   {
  531.       BIO *ret;

ssl/bio_ssl.c:534:9: 
  532.       SSL *ssl;
  533.   
  534. >     if ((ret = BIO_new(BIO_f_ssl())) == NULL)
  535.           return (NULL);
  536.       if ((ssl = SSL_new(ctx)) == NULL) {

ssl/bio_ssl.c:96:1: start of procedure BIO_f_ssl()
    94.   };
    95.   
    96. > BIO_METHOD *BIO_f_ssl(void)
    97.   {
    98.       return (&methods_sslp);

ssl/bio_ssl.c:98:5: 
    96.   BIO_METHOD *BIO_f_ssl(void)
    97.   {
    98. >     return (&methods_sslp);
    99.   }
    100.   

ssl/bio_ssl.c:99:1: return from a call to BIO_f_ssl
    97.   {
    98.       return (&methods_sslp);
    99. > }
    100.   
    101.   static int ssl_new(BIO *bi)

crypto/bio/bio_lib.c:65:1: start of procedure BIO_new()
    63.   #include <openssl/stack.h>
    64.   
    65. > BIO *BIO_new(BIO_METHOD *method)
    66.   {
    67.       BIO *ret = OPENSSL_malloc(sizeof(*ret));

crypto/bio/bio_lib.c:67:5: 
    65.   BIO *BIO_new(BIO_METHOD *method)
    66.   {
    67. >     BIO *ret = OPENSSL_malloc(sizeof(*ret));
    68.   
    69.       if (ret == NULL) {

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

crypto/mem.c:126:5: 
      124.           return NULL;
      125.   
      126. >     allow_customize = 0;
      127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

crypto/mem.c:138:5: 
      136.       (void)file;
      137.       (void)line;
      138. >     ret = malloc(num);
      139.   #endif
      140.   

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
      152.   
      153.       return ret;
      154. > }
      155.   
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/bio/bio_lib.c:69:9: Taking false branch
    67.       BIO *ret = OPENSSL_malloc(sizeof(*ret));
    68.   
    69.       if (ret == NULL) {
                  ^
    70.           BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE);
    71.           return (NULL);

crypto/bio/bio_lib.c:73:10: Taking true branch
    71.           return (NULL);
    72.       }
    73.       if (!BIO_set(ret, method)) {
                   ^
    74.           OPENSSL_free(ret);
    75.           ret = NULL;

crypto/bio/bio_lib.c:74:9: 
    72.       }
    73.       if (!BIO_set(ret, method)) {
    74. >         OPENSSL_free(ret);
    75.           ret = NULL;
    76.       }

crypto/mem.c:233:1: start of procedure CRYPTO_free()
      231.   }
      232.   
      233. > void CRYPTO_free(void *str)
      234.   {
      235.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:244:5: 
      242.       }
      243.   #else
      244. >     free(str);
      245.   #endif
      246.   }

crypto/mem.c:246:1: return from a call to CRYPTO_free
      244.       free(str);
      245.   #endif
      246. > }
      247.   
      248.   void CRYPTO_clear_free(void *str, size_t num)

crypto/bio/bio_lib.c:75:9: 
    73.       if (!BIO_set(ret, method)) {
    74.           OPENSSL_free(ret);
    75. >         ret = NULL;
    76.       }
    77.       return (ret);

crypto/bio/bio_lib.c:77:5: 
    75.           ret = NULL;
    76.       }
    77. >     return (ret);
    78.   }
    79.   

crypto/bio/bio_lib.c:78:1: return from a call to BIO_new
    76.       }
    77.       return (ret);
    78. > }
    79.   
    80.   int BIO_set(BIO *bio, BIO_METHOD *method)

ssl/bio_ssl.c:534:9: Taking true branch
  532.       SSL *ssl;
  533.   
  534.       if ((ret = BIO_new(BIO_f_ssl())) == NULL)
                 ^
  535.           return (NULL);
  536.       if ((ssl = SSL_new(ctx)) == NULL) {

ssl/bio_ssl.c:535:9: 
  533.   
  534.       if ((ret = BIO_new(BIO_f_ssl())) == NULL)
  535. >         return (NULL);
  536.       if ((ssl = SSL_new(ctx)) == NULL) {
  537.           BIO_free(ret);

ssl/bio_ssl.c:547:1: return from a call to BIO_new_ssl
  545.       BIO_set_ssl(ret, ssl, BIO_CLOSE);
  546.       return (ret);
  547. > }
  548.   
  549.   int BIO_ssl_copy_session_id(BIO *t, BIO *f)

ssl/bio_ssl.c:518:9: Taking true branch
516.       if ((con = BIO_new(BIO_s_connect())) == NULL)
517.           return (NULL);
518.       if ((ssl = BIO_new_ssl(ctx, 1)) == NULL)
               ^
519.           goto err;
520.       if ((ret = BIO_push(ssl, con)) == NULL)

ssl/bio_ssl.c:523:2: 
521.           goto err;
522.       return (ret);
523. >  err:
524.       BIO_free(con);
525.   #endif

ssl/bio_ssl.c:524:5: 
522.       return (ret);
523.    err:
524. >     BIO_free(con);
525.   #endif
526.       return (NULL);

crypto/bio/bio_lib.c:105:1: start of procedure BIO_free()
  103.   }
  104.   
  105. > int BIO_free(BIO *a)
  106.   {
  107.       int i;

crypto/bio/bio_lib.c:109:9: Taking false branch
  107.       int i;
  108.   
  109.       if (a == NULL)
                 ^
  110.           return (0);
  111.   

crypto/bio/bio_lib.c:112:5: 
  110.           return (0);
  111.   
  112. >     i = CRYPTO_add(&a->references, -1, CRYPTO_LOCK_BIO);
  113.   #ifdef REF_PRINT
  114.       REF_PRINT("BIO", a);

crypto/lock.c:455:1: start of procedure CRYPTO_add_lock()
    453.   }
    454.   
    455. > int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
    456.                       int line)
    457.   {

crypto/lock.c:458:5: 
    456.                       int line)
    457.   {
    458. >     int ret = 0;
    459.   
    460.       if (add_lock_callback != NULL) {

crypto/lock.c:460:9: Taking false branch
    458.       int ret = 0;
    459.   
    460.       if (add_lock_callback != NULL) {
                   ^
    461.   #ifdef LOCK_DEBUG
    462.           int before = *pointer;

crypto/lock.c:476:9: 
    474.   #endif
    475.       } else {
    476. >         CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
    477.   
    478.           ret = *pointer + amount;

crypto/lock.c:413:1: start of procedure CRYPTO_lock()
      411.   }
      412.   
      413. > void CRYPTO_lock(int mode, int type, const char *file, int line)
      414.   {
      415.   #ifdef LOCK_DEBUG

crypto/lock.c:440:9: Taking false branch
      438.       }
      439.   #endif
      440.       if (type < 0) {
                     ^
      441.           if (dynlock_lock_callback != NULL) {
      442.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:451:16: Taking false branch
      449.               CRYPTO_destroy_dynlockid(type);
      450.           }
      451.       } else if (locking_callback != NULL)
                            ^
      452.           locking_callback(mode, type, file, line);
      453.   }

crypto/lock.c:440:5: 
      438.       }
      439.   #endif
      440. >     if (type < 0) {
      441.           if (dynlock_lock_callback != NULL) {
      442.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:453:1: return from a call to CRYPTO_lock
      451.       } else if (locking_callback != NULL)
      452.           locking_callback(mode, type, file, line);
      453. > }
      454.   
      455.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/lock.c:478:9: 
    476.           CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
    477.   
    478. >         ret = *pointer + amount;
    479.   #ifdef LOCK_DEBUG
    480.           {

crypto/lock.c:489:9: 
    487.           }
    488.   #endif
    489. >         *pointer = ret;
    490.           CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
    491.       }

crypto/lock.c:490:9: 
    488.   #endif
    489.           *pointer = ret;
    490. >         CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
    491.       }
    492.       return (ret);

crypto/lock.c:413:1: start of procedure CRYPTO_lock()
      411.   }
      412.   
      413. > void CRYPTO_lock(int mode, int type, const char *file, int line)
      414.   {
      415.   #ifdef LOCK_DEBUG

crypto/lock.c:440:9: Taking false branch
      438.       }
      439.   #endif
      440.       if (type < 0) {
                     ^
      441.           if (dynlock_lock_callback != NULL) {
      442.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:451:16: Taking false branch
      449.               CRYPTO_destroy_dynlockid(type);
      450.           }
      451.       } else if (locking_callback != NULL)
                            ^
      452.           locking_callback(mode, type, file, line);
      453.   }

crypto/lock.c:440:5: 
      438.       }
      439.   #endif
      440. >     if (type < 0) {
      441.           if (dynlock_lock_callback != NULL) {
      442.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:453:1: return from a call to CRYPTO_lock
      451.       } else if (locking_callback != NULL)
      452.           locking_callback(mode, type, file, line);
      453. > }
      454.   
      455.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/lock.c:492:5: 
    490.           CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
    491.       }
    492. >     return (ret);
    493.   }
    494.   

crypto/lock.c:493:1: return from a call to CRYPTO_add_lock
    491.       }
    492.       return (ret);
    493. > }
    494.   
    495.   const char *CRYPTO_get_lock_name(int type)

crypto/bio/bio_lib.c:116:9: Taking false branch
  114.       REF_PRINT("BIO", a);
  115.   #endif
  116.       if (i > 0)
                 ^
  117.           return (1);
  118.   #ifdef REF_CHECK

crypto/bio/bio_lib.c:124:10: Taking true branch
  122.       }
  123.   #endif
  124.       if ((a->callback != NULL) &&
                  ^
  125.           ((i = (int)a->callback(a, BIO_CB_FREE, NULL, 0, 0L, 1L)) <= 0))
  126.           return (i);

crypto/bio/bio_lib.c:125:10: Taking true branch
  123.   #endif
  124.       if ((a->callback != NULL) &&
  125.           ((i = (int)a->callback(a, BIO_CB_FREE, NULL, 0, 0L, 1L)) <= 0))
                  ^
  126.           return (i);
  127.   

crypto/bio/bio_lib.c:126:9: 
  124.       if ((a->callback != NULL) &&
  125.           ((i = (int)a->callback(a, BIO_CB_FREE, NULL, 0, 0L, 1L)) <= 0))
  126. >         return (i);
  127.   
  128.       CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);

crypto/bio/bio_lib.c:134:1: return from a call to BIO_free
  132.       OPENSSL_free(a);
  133.       return (1);
  134. > }
  135.   
  136.   void BIO_vfree(BIO *a)
