crypto/dsa/dsa_prn.c:27: error: MEMORY_LEAK
  memory dynamically allocated by call to `BIO_new()` at line 21, column 14 is not reachable after line 27, column 5.
Showing all 42 steps of the trace


crypto/dsa/dsa_prn.c:16:1: start of procedure DSA_print_fp()
14.   
15.   #ifndef OPENSSL_NO_STDIO
16. > int DSA_print_fp(FILE *fp, const DSA *x, int off)
17.   {
18.       BIO *b;

crypto/dsa/dsa_prn.c:21:9: 
19.       int ret;
20.   
21. >     if ((b = BIO_new(BIO_s_file())) == NULL) {
22.           DSAerr(DSA_F_DSA_PRINT_FP, ERR_R_BUF_LIB);
23.           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)

crypto/dsa/dsa_prn.c:21:9: Taking false branch
19.       int ret;
20.   
21.       if ((b = BIO_new(BIO_s_file())) == NULL) {
              ^
22.           DSAerr(DSA_F_DSA_PRINT_FP, ERR_R_BUF_LIB);
23.           return (0);

crypto/dsa/dsa_prn.c:25:5: 
23.           return (0);
24.       }
25. >     BIO_set_fp(b, fp, BIO_NOCLOSE);
26.       ret = DSA_print(b, x, off);
27.       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 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:356:5: 
  354.       }
  355.   
  356. >     cb = b->callback;
  357.   
  358.       if ((cb != NULL) &&

crypto/bio/bio_lib.c:358:10: Taking true branch
  356.       cb = b->callback;
  357.   
  358.       if ((cb != NULL) &&
                  ^
  359.           ((ret = cb(b, BIO_CB_CTRL, parg, cmd, larg, 1L)) <= 0))
  360.           return (ret);

crypto/bio/bio_lib.c:359:10: Taking false branch
  357.   
  358.       if ((cb != NULL) &&
  359.           ((ret = cb(b, BIO_CB_CTRL, parg, cmd, larg, 1L)) <= 0))
                  ^
  360.           return (ret);
  361.   

crypto/bio/bio_lib.c:362:5: Skipping __function_pointer__(): unresolved function pointer
  360.           return (ret);
  361.   
  362.       ret = b->method->ctrl(b, cmd, larg, parg);
             ^
  363.   
  364.       if (cb != NULL)

crypto/bio/bio_lib.c:364:9: Taking true branch
  362.       ret = b->method->ctrl(b, cmd, larg, parg);
  363.   
  364.       if (cb != NULL)
                 ^
  365.           ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret);
  366.       return (ret);

crypto/bio/bio_lib.c:365:9: Skipping __function_pointer__(): unresolved function pointer
  363.   
  364.       if (cb != NULL)
  365.           ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret);
                 ^
  366.       return (ret);
  367.   }

crypto/bio/bio_lib.c:366:5: 
  364.       if (cb != NULL)
  365.           ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret);
  366. >     return (ret);
  367.   }
  368.   

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,

crypto/dsa/dsa_prn.c:26:5: 
24.       }
25.       BIO_set_fp(b, fp, BIO_NOCLOSE);
26. >     ret = DSA_print(b, x, off);
27.       BIO_free(b);
28.       return (ret);

crypto/dsa/dsa_prn.c:47:1: start of procedure DSA_print()
  45.   #endif
  46.   
  47. > int DSA_print(BIO *bp, const DSA *x, int off)
  48.   {
  49.       EVP_PKEY *pk;

crypto/dsa/dsa_prn.c:51:5: Skipping EVP_PKEY_new(): empty list of specs
  49.       EVP_PKEY *pk;
  50.       int ret;
  51.       pk = EVP_PKEY_new();
            ^
  52.       if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
  53.           return 0;

crypto/dsa/dsa_prn.c:52:9: Taking true branch
  50.       int ret;
  51.       pk = EVP_PKEY_new();
  52.       if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
                ^
  53.           return 0;
  54.       ret = EVP_PKEY_print_private(bp, pk, off, NULL);

crypto/dsa/dsa_prn.c:53:9: 
  51.       pk = EVP_PKEY_new();
  52.       if (pk == NULL || !EVP_PKEY_set1_DSA(pk, (DSA *)x))
  53. >         return 0;
  54.       ret = EVP_PKEY_print_private(bp, pk, off, NULL);
  55.       EVP_PKEY_free(pk);

crypto/dsa/dsa_prn.c:57:1: return from a call to DSA_print
  55.       EVP_PKEY_free(pk);
  56.       return ret;
  57. > }
  58.   
  59.   int DSAparams_print(BIO *bp, const DSA *x)

crypto/dsa/dsa_prn.c:27:5: Skipping BIO_free(): empty list of specs
25.       BIO_set_fp(b, fp, BIO_NOCLOSE);
26.       ret = DSA_print(b, x, off);
27.       BIO_free(b);
          ^
28.       return (ret);
29.   }
