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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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