crypto/rsa/rsa_depr.c:101: error: MEMORY_LEAK
  memory dynamically allocated by call to `BN_new()` at line 78, column 17 is not reachable after line 101, column 5.
Showing all 79 steps of the trace


crypto/rsa/rsa_depr.c:72:1: start of procedure RSA_generate_key()
70.   # include <openssl/rsa.h>
71.   
72. > RSA *RSA_generate_key(int bits, unsigned long e_value,
73.                         void (*callback) (int, int, void *), void *cb_arg)
74.   {

crypto/rsa/rsa_depr.c:76:5: 
74.   {
75.       int i;
76. >     BN_GENCB *cb = BN_GENCB_new();
77.       RSA *rsa = RSA_new();
78.       BIGNUM *e = BN_new();

crypto/bn/bn_lib.c:1017:1: start of procedure BN_GENCB_new()
  1015.   }
  1016.   
  1017. > BN_GENCB *BN_GENCB_new(void)
  1018.   {
  1019.       BN_GENCB *ret;

crypto/bn/bn_lib.c:1021:9: 
  1019.       BN_GENCB *ret;
  1020.   
  1021. >     if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) {
  1022.           BNerr(BN_F_BN_GENCB_NEW, ERR_R_MALLOC_FAILURE);
  1023.           return (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/bn/bn_lib.c:1021:9: Taking false branch
  1019.       BN_GENCB *ret;
  1020.   
  1021.       if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) {
                  ^
  1022.           BNerr(BN_F_BN_GENCB_NEW, ERR_R_MALLOC_FAILURE);
  1023.           return (NULL);

crypto/bn/bn_lib.c:1026:5: 
  1024.       }
  1025.   
  1026. >     return ret;
  1027.   }
  1028.   

crypto/bn/bn_lib.c:1027:1: return from a call to BN_GENCB_new
  1025.   
  1026.       return ret;
  1027. > }
  1028.   
  1029.   void BN_GENCB_free(BN_GENCB *cb)

crypto/rsa/rsa_depr.c:77:5: 
75.       int i;
76.       BN_GENCB *cb = BN_GENCB_new();
77. >     RSA *rsa = RSA_new();
78.       BIGNUM *e = BN_new();
79.   

crypto/rsa/rsa_lib.c:71:1: start of procedure RSA_new()
  69.   static const RSA_METHOD *default_RSA_meth = NULL;
  70.   
  71. > RSA *RSA_new(void)
  72.   {
  73.       RSA *r = RSA_new_method(NULL);

crypto/rsa/rsa_lib.c:73:5: 
  71.   RSA *RSA_new(void)
  72.   {
  73. >     RSA *r = RSA_new_method(NULL);
  74.   
  75.       return r;

crypto/rsa/rsa_lib.c:123:1: start of procedure RSA_new_method()
    121.   }
    122.   
    123. > RSA *RSA_new_method(ENGINE *engine)
    124.   {
    125.       RSA *ret;

crypto/rsa/rsa_lib.c:127:5: 
    125.       RSA *ret;
    126.   
    127. >     ret = OPENSSL_zalloc(sizeof(*ret));
    128.       if (ret == NULL) {
    129.           RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
      154.   }
      155.   
      156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
      157.   {
      158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
      157.   {
      158. >     void *ret = CRYPTO_malloc(num, file, line);
      159.   
      160.       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/mem.c:160:9: Taking false branch
      158.       void *ret = CRYPTO_malloc(num, file, line);
      159.   
      160.       if (ret != NULL)
                     ^
      161.           memset(ret, 0, num);
      162.       return ret;

crypto/mem.c:162:5: 
      160.       if (ret != NULL)
      161.           memset(ret, 0, num);
      162. >     return ret;
      163.   }
      164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
      161.           memset(ret, 0, num);
      162.       return ret;
      163. > }
      164.   
      165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/rsa/rsa_lib.c:128:9: Taking true branch
    126.   
    127.       ret = OPENSSL_zalloc(sizeof(*ret));
    128.       if (ret == NULL) {
                   ^
    129.           RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
    130.           return NULL;

crypto/rsa/rsa_lib.c:129:9: Skipping ERR_put_error(): empty list of specs
    127.       ret = OPENSSL_zalloc(sizeof(*ret));
    128.       if (ret == NULL) {
    129.           RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
                   ^
    130.           return NULL;
    131.       }

crypto/rsa/rsa_lib.c:130:9: 
    128.       if (ret == NULL) {
    129.           RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
    130. >         return NULL;
    131.       }
    132.   

crypto/rsa/rsa_lib.c:176:1: return from a call to RSA_new_method
    174.       }
    175.       return (ret);
    176. > }
    177.   
    178.   void RSA_free(RSA *r)

crypto/rsa/rsa_lib.c:75:5: 
  73.       RSA *r = RSA_new_method(NULL);
  74.   
  75. >     return r;
  76.   }
  77.   

crypto/rsa/rsa_lib.c:76:1: return from a call to RSA_new
  74.   
  75.       return r;
  76. > }
  77.   
  78.   void RSA_set_default_method(const RSA_METHOD *meth)

crypto/rsa/rsa_depr.c:78:5: 
76.       BN_GENCB *cb = BN_GENCB_new();
77.       RSA *rsa = RSA_new();
78. >     BIGNUM *e = BN_new();
79.   
80.       if (cb == NULL || rsa == NULL || e == NULL)

crypto/bn/bn_lib.c:276:1: start of procedure BN_new()
  274.   }
  275.   
  276. > BIGNUM *BN_new(void)
  277.   {
  278.       BIGNUM *ret;

crypto/bn/bn_lib.c:280:9: 
  278.       BIGNUM *ret;
  279.   
  280. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
  281.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  282.           return (NULL);

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
    154.   }
    155.   
    156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       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/mem.c:160:9: Taking true branch
    158.       void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)
                   ^
    161.           memset(ret, 0, num);
    162.       return ret;

crypto/mem.c:161:9: 
    159.   
    160.       if (ret != NULL)
    161. >         memset(ret, 0, num);
    162.       return ret;
    163.   }

crypto/mem.c:162:5: 
    160.       if (ret != NULL)
    161.           memset(ret, 0, num);
    162. >     return ret;
    163.   }
    164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
    161.           memset(ret, 0, num);
    162.       return ret;
    163. > }
    164.   
    165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/bn/bn_lib.c:280:9: Taking false branch
  278.       BIGNUM *ret;
  279.   
  280.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
                 ^
  281.           BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
  282.           return (NULL);

crypto/bn/bn_lib.c:284:5: 
  282.           return (NULL);
  283.       }
  284. >     ret->flags = BN_FLG_MALLOCED;
  285.       bn_check_top(ret);
  286.       return (ret);

crypto/bn/bn_lib.c:286:5: 
  284.       ret->flags = BN_FLG_MALLOCED;
  285.       bn_check_top(ret);
  286. >     return (ret);
  287.   }
  288.   

crypto/bn/bn_lib.c:287:1: return from a call to BN_new
  285.       bn_check_top(ret);
  286.       return (ret);
  287. > }
  288.   
  289.    BIGNUM *BN_secure_new(void)

crypto/rsa/rsa_depr.c:80:9: Taking false branch
78.       BIGNUM *e = BN_new();
79.   
80.       if (cb == NULL || rsa == NULL || e == NULL)
              ^
81.           goto err;
82.   

crypto/rsa/rsa_depr.c:80:23: Taking true branch
78.       BIGNUM *e = BN_new();
79.   
80.       if (cb == NULL || rsa == NULL || e == NULL)
                            ^
81.           goto err;
82.   

crypto/rsa/rsa_depr.c:100:2: 
98.           return rsa;
99.       }
100. >  err:
101.       BN_free(e);
102.       RSA_free(rsa);

crypto/rsa/rsa_depr.c:101:5: 
99.       }
100.    err:
101. >     BN_free(e);
102.       RSA_free(rsa);
103.       BN_GENCB_free(cb);

crypto/bn/bn_lib.c:251:1: start of procedure BN_free()
  249.   }
  250.   
  251. > void BN_free(BIGNUM *a)
  252.   {
  253.       if (a == NULL)

crypto/bn/bn_lib.c:253:9: Taking false branch
  251.   void BN_free(BIGNUM *a)
  252.   {
  253.       if (a == NULL)
                 ^
  254.           return;
  255.       bn_check_top(a);

crypto/bn/bn_lib.c:256:10: 
  254.           return;
  255.       bn_check_top(a);
  256. >     if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  257.           bn_free_d(a);
  258.       if (a->flags & BN_FLG_MALLOCED)

crypto/bn/bn_lib.c:1041:1: start of procedure BN_get_flags()
    1039.   }
    1040.   
    1041. > int BN_get_flags(const BIGNUM *b, int n)
    1042.   {
    1043.       return b->flags & n;

crypto/bn/bn_lib.c:1043:5: 
    1041.   int BN_get_flags(const BIGNUM *b, int n)
    1042.   {
    1043. >     return b->flags & n;
    1044.   }
    1045.   

crypto/bn/bn_lib.c:1044:1: return from a call to BN_get_flags
    1042.   {
    1043.       return b->flags & n;
    1044. > }
    1045.   
    1046.   /* Populate a BN_GENCB structure with an "old"-style callback */

crypto/bn/bn_lib.c:256:10: Taking false branch
  254.           return;
  255.       bn_check_top(a);
  256.       if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
                  ^
  257.           bn_free_d(a);
  258.       if (a->flags & BN_FLG_MALLOCED)

crypto/bn/bn_lib.c:258:9: Taking false branch
  256.       if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  257.           bn_free_d(a);
  258.       if (a->flags & BN_FLG_MALLOCED)
                 ^
  259.           OPENSSL_free(a);
  260.       else {

crypto/bn/bn_lib.c:262:9: 
  260.       else {
  261.   #if OPENSSL_API_COMPAT < 0x00908000L
  262. >         a->flags |= BN_FLG_FREE;
  263.   #endif
  264.           a->d = NULL;

crypto/bn/bn_lib.c:264:9: 
  262.           a->flags |= BN_FLG_FREE;
  263.   #endif
  264. >         a->d = NULL;
  265.       }
  266.   }

crypto/bn/bn_lib.c:258:5: 
  256.       if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
  257.           bn_free_d(a);
  258. >     if (a->flags & BN_FLG_MALLOCED)
  259.           OPENSSL_free(a);
  260.       else {

crypto/bn/bn_lib.c:266:1: return from a call to BN_free
  264.           a->d = NULL;
  265.       }
  266. > }
  267.   
  268.   void bn_init(BIGNUM *a)
