ssl/ssl_txt.c:53: error: MEMORY_LEAK
  memory dynamically allocated by call to `BIO_new()` at line 47, column 14 is not reachable after line 53, column 5.
Showing all 48 steps of the trace


ssl/ssl_txt.c:42:1: start of procedure SSL_SESSION_print_fp()
40.   
41.   #ifndef OPENSSL_NO_STDIO
42. > int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x)
43.   {
44.       BIO *b;

ssl/ssl_txt.c:47:9: 
45.       int ret;
46.   
47. >     if ((b = BIO_new(BIO_s_file())) == NULL) {
48.           SSLerr(SSL_F_SSL_SESSION_PRINT_FP, ERR_R_BUF_LIB);
49.           return (0);

crypto/bio/bss_file.c:106:1: start of procedure BIO_s_file()
  104.   }
  105.   
  106. > const BIO_METHOD *BIO_s_file(void)
  107.   {
  108.       return (&methods_filep);

crypto/bio/bss_file.c:108:5: 
  106.   const BIO_METHOD *BIO_s_file(void)
  107.   {
  108. >     return (&methods_filep);
  109.   }
  110.   

crypto/bio/bss_file.c:109:1: return from a call to BIO_s_file
  107.   {
  108.       return (&methods_filep);
  109. > }
  110.   
  111.   static int file_new(BIO *bi)

crypto/bio/bio_lib.c:17:1: start of procedure BIO_new()
  15.   #include <openssl/stack.h>
  16.   
  17. > BIO *BIO_new(const BIO_METHOD *method)
  18.   {
  19.       BIO *ret = OPENSSL_malloc(sizeof(*ret));

crypto/bio/bio_lib.c:19:5: 
  17.   BIO *BIO_new(const BIO_METHOD *method)
  18.   {
  19. >     BIO *ret = OPENSSL_malloc(sizeof(*ret));
  20.   
  21.       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/bio/bio_lib.c:21:9: Taking false branch
  19.       BIO *ret = OPENSSL_malloc(sizeof(*ret));
  20.   
  21.       if (ret == NULL) {
                ^
  22.           BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE);
  23.           return (NULL);

crypto/bio/bio_lib.c:25:10: Taking false branch
  23.           return (NULL);
  24.       }
  25.       if (!BIO_set(ret, method)) {
                 ^
  26.           OPENSSL_free(ret);
  27.           ret = NULL;

crypto/bio/bio_lib.c:29:5: 
  27.           ret = NULL;
  28.       }
  29. >     return (ret);
  30.   }
  31.   

crypto/bio/bio_lib.c:30:1: return from a call to BIO_new
  28.       }
  29.       return (ret);
  30. > }
  31.   
  32.   int BIO_set(BIO *bio, const BIO_METHOD *method)

ssl/ssl_txt.c:47:9: Taking false branch
45.       int ret;
46.   
47.       if ((b = BIO_new(BIO_s_file())) == NULL) {
              ^
48.           SSLerr(SSL_F_SSL_SESSION_PRINT_FP, ERR_R_BUF_LIB);
49.           return (0);

ssl/ssl_txt.c:51:5: 
49.           return (0);
50.       }
51. >     BIO_set_fp(b, fp, BIO_NOCLOSE);
52.       ret = SSL_SESSION_print(b, x);
53.       BIO_free(b);

crypto/bio/bio_lib.c:343:1: start of procedure BIO_ctrl()
  341.   }
  342.   
  343. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
  344.   {
  345.       long ret;

crypto/bio/bio_lib.c:348:9: Taking false branch
  346.       long (*cb) (BIO *, int, const char *, int, long, long);
  347.   
  348.       if (b == NULL)
                 ^
  349.           return (0);
  350.   

crypto/bio/bio_lib.c:351:10: Taking false branch
  349.           return (0);
  350.   
  351.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {
                  ^
  352.           BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
  353.           return (-2);

crypto/bio/bio_lib.c:351:33: Taking true branch
  349.           return (0);
  350.   
  351.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {
                                         ^
  352.           BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
  353.           return (-2);

crypto/bio/bio_lib.c:352:9: Skipping ERR_put_error(): empty list of specs
  350.   
  351.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {
  352.           BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
                 ^
  353.           return (-2);
  354.       }

crypto/bio/bio_lib.c:353:9: 
  351.       if ((b->method == NULL) || (b->method->ctrl == NULL)) {
  352.           BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
  353. >         return (-2);
  354.       }
  355.   

crypto/bio/bio_lib.c:367:1: return from a call to BIO_ctrl
  365.           ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret);
  366.       return (ret);
  367. > }
  368.   
  369.   long BIO_callback_ctrl(BIO *b, int cmd,

ssl/ssl_txt.c:52:5: 
50.       }
51.       BIO_set_fp(b, fp, BIO_NOCLOSE);
52. >     ret = SSL_SESSION_print(b, x);
53.       BIO_free(b);
54.       return (ret);

ssl/ssl_txt.c:58:1: start of procedure SSL_SESSION_print()
  56.   #endif
  57.   
  58. > int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x)
  59.   {
  60.       unsigned int i;

ssl/ssl_txt.c:63:9: Taking false branch
  61.       const char *s;
  62.   
  63.       if (x == NULL)
                ^
  64.           goto err;
  65.       if (BIO_puts(bp, "SSL-Session:\n") <= 0)

ssl/ssl_txt.c:65:9: 
  63.       if (x == NULL)
  64.           goto err;
  65. >     if (BIO_puts(bp, "SSL-Session:\n") <= 0)
  66.           goto err;
  67.       s = ssl_protocol_to_string(x->ssl_version);

crypto/bio/bio_lib.c:256:1: start of procedure BIO_puts()
    254.   }
    255.   
    256. > int BIO_puts(BIO *b, const char *in)
    257.   {
    258.       int i;

crypto/bio/bio_lib.c:261:10: Taking false branch
    259.       long (*cb) (BIO *, int, const char *, int, long, long);
    260.   
    261.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                    ^
    262.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
    263.           return (-2);

crypto/bio/bio_lib.c:261:25: Taking false branch
    259.       long (*cb) (BIO *, int, const char *, int, long, long);
    260.   
    261.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                   ^
    262.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
    263.           return (-2);

crypto/bio/bio_lib.c:261:48: Taking false branch
    259.       long (*cb) (BIO *, int, const char *, int, long, long);
    260.   
    261.       if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
                                                          ^
    262.           BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
    263.           return (-2);

crypto/bio/bio_lib.c:266:5: 
    264.       }
    265.   
    266. >     cb = b->callback;
    267.   
    268.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))

crypto/bio/bio_lib.c:268:10: Taking true branch
    266.       cb = b->callback;
    267.   
    268.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))
                    ^
    269.           return (i);
    270.   

crypto/bio/bio_lib.c:268:26: Taking true branch
    266.       cb = b->callback;
    267.   
    268.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))
                                    ^
    269.           return (i);
    270.   

crypto/bio/bio_lib.c:269:9: 
    267.   
    268.       if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0))
    269. >         return (i);
    270.   
    271.       if (!b->init) {

crypto/bio/bio_lib.c:284:1: return from a call to BIO_puts
    282.           i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i);
    283.       return (i);
    284. > }
    285.   
    286.   int BIO_gets(BIO *b, char *in, int inl)

ssl/ssl_txt.c:65:9: Taking true branch
  63.       if (x == NULL)
  64.           goto err;
  65.       if (BIO_puts(bp, "SSL-Session:\n") <= 0)
                ^
  66.           goto err;
  67.       s = ssl_protocol_to_string(x->ssl_version);

ssl/ssl_txt.c:175:2: 
  173.   
  174.       return (1);
  175. >  err:
  176.       return (0);
  177.   }

ssl/ssl_txt.c:176:5: 
  174.       return (1);
  175.    err:
  176. >     return (0);
  177.   }
  178.   

ssl/ssl_txt.c:177:1: return from a call to SSL_SESSION_print
  175.    err:
  176.       return (0);
  177. > }
  178.   
  179.   /*

ssl/ssl_txt.c:53:5: Skipping BIO_free(): empty list of specs
51.       BIO_set_fp(b, fp, BIO_NOCLOSE);
52.       ret = SSL_SESSION_print(b, x);
53.       BIO_free(b);
          ^
54.       return (ret);
55.   }
