crypto/ec/ec_ameth.c:374: error: MEMORY_LEAK
  memory dynamically allocated by call to `BN_new()` at line 359, column 21 is not reachable after line 374, column 5.
Showing all 65 steps of the trace


crypto/ec/ec_ameth.c:357:1: start of procedure ec_bits()
355.   }
356.   
357. > static int ec_bits(const EVP_PKEY *pkey)
358.   {
359.       BIGNUM *order = BN_new();

crypto/ec/ec_ameth.c:359:5: 
357.   static int ec_bits(const EVP_PKEY *pkey)
358.   {
359. >     BIGNUM *order = BN_new();
360.       const EC_GROUP *group;
361.       int ret;

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

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

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

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

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

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

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

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

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

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

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

crypto/ec/ec_ameth.c:363:9: Taking false branch
361.       int ret;
362.   
363.       if (order == NULL) {
               ^
364.           ERR_clear_error();
365.           return 0;

crypto/ec/ec_ameth.c:367:5: 
365.           return 0;
366.       }
367. >     group = EC_KEY_get0_group(pkey->pkey.ec);
368.       if (!EC_GROUP_get_order(group, order, NULL)) {
369.           ERR_clear_error();

crypto/ec/ec_key.c:438:1: start of procedure EC_KEY_get0_group()
  436.   }
  437.   
  438. > const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)
  439.   {
  440.       return key->group;

crypto/ec/ec_key.c:440:5: 
  438.   const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)
  439.   {
  440. >     return key->group;
  441.   }
  442.   

crypto/ec/ec_key.c:441:1: return from a call to EC_KEY_get0_group
  439.   {
  440.       return key->group;
  441. > }
  442.   
  443.   int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group)

crypto/ec/ec_ameth.c:368:10: 
366.       }
367.       group = EC_KEY_get0_group(pkey->pkey.ec);
368. >     if (!EC_GROUP_get_order(group, order, NULL)) {
369.           ERR_clear_error();
370.           return 0;

crypto/ec/ec_lib.c:351:1: start of procedure EC_GROUP_get_order()
  349.   }
  350.   
  351. > int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx)
  352.   {
  353.       if (!BN_copy(order, group->order))

crypto/ec/ec_lib.c:353:10: Taking false branch
  351.   int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx)
  352.   {
  353.       if (!BN_copy(order, group->order))
                  ^
  354.           return 0;
  355.   

crypto/ec/ec_lib.c:356:13: 
  354.           return 0;
  355.   
  356. >     return !BN_is_zero(order);
  357.   }
  358.   

crypto/bn/bn_lib.c:899:1: start of procedure BN_is_zero()
    897.   }
    898.   
    899. > int BN_is_zero(const BIGNUM *a)
    900.   {
    901.       return a->top == 0;

crypto/bn/bn_lib.c:901:12: Condition is false
    899.   int BN_is_zero(const BIGNUM *a)
    900.   {
    901.       return a->top == 0;
                      ^
    902.   }
    903.   

crypto/bn/bn_lib.c:901:5: 
    899.   int BN_is_zero(const BIGNUM *a)
    900.   {
    901. >     return a->top == 0;
    902.   }
    903.   

crypto/bn/bn_lib.c:902:1: return from a call to BN_is_zero
    900.   {
    901.       return a->top == 0;
    902. > }
    903.   
    904.   int BN_is_one(const BIGNUM *a)

crypto/ec/ec_lib.c:356:13: Condition is false
  354.           return 0;
  355.   
  356.       return !BN_is_zero(order);
                     ^
  357.   }
  358.   

crypto/ec/ec_lib.c:356:12: 
  354.           return 0;
  355.   
  356. >     return !BN_is_zero(order);
  357.   }
  358.   

crypto/ec/ec_lib.c:356:5: 
  354.           return 0;
  355.   
  356. >     return !BN_is_zero(order);
  357.   }
  358.   

crypto/ec/ec_lib.c:357:1: return from a call to EC_GROUP_get_order
  355.   
  356.       return !BN_is_zero(order);
  357. > }
  358.   
  359.   int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor,

crypto/ec/ec_ameth.c:368:10: Taking false branch
366.       }
367.       group = EC_KEY_get0_group(pkey->pkey.ec);
368.       if (!EC_GROUP_get_order(group, order, NULL)) {
                ^
369.           ERR_clear_error();
370.           return 0;

crypto/ec/ec_ameth.c:373:5: 
371.       }
372.   
373. >     ret = BN_num_bits(order);
374.       BN_free(order);
375.       return ret;

crypto/bn/bn_lib.c:215:1: start of procedure BN_num_bits()
  213.   }
  214.   
  215. > int BN_num_bits(const BIGNUM *a)
  216.   {
  217.       int i = a->top - 1;

crypto/bn/bn_lib.c:217:5: 
  215.   int BN_num_bits(const BIGNUM *a)
  216.   {
  217. >     int i = a->top - 1;
  218.       bn_check_top(a);
  219.   

crypto/bn/bn_lib.c:220:9: 
  218.       bn_check_top(a);
  219.   
  220. >     if (BN_is_zero(a))
  221.           return 0;
  222.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:899:1: start of procedure BN_is_zero()
    897.   }
    898.   
    899. > int BN_is_zero(const BIGNUM *a)
    900.   {
    901.       return a->top == 0;

crypto/bn/bn_lib.c:901:12: Condition is false
    899.   int BN_is_zero(const BIGNUM *a)
    900.   {
    901.       return a->top == 0;
                      ^
    902.   }
    903.   

crypto/bn/bn_lib.c:901:5: 
    899.   int BN_is_zero(const BIGNUM *a)
    900.   {
    901. >     return a->top == 0;
    902.   }
    903.   

crypto/bn/bn_lib.c:902:1: return from a call to BN_is_zero
    900.   {
    901.       return a->top == 0;
    902. > }
    903.   
    904.   int BN_is_one(const BIGNUM *a)

crypto/bn/bn_lib.c:220:9: Taking false branch
  218.       bn_check_top(a);
  219.   
  220.       if (BN_is_zero(a))
                 ^
  221.           return 0;
  222.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:222:5: Skipping BN_num_bits_word(): empty list of specs
  220.       if (BN_is_zero(a))
  221.           return 0;
  222.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
             ^
  223.   }
  224.   

crypto/bn/bn_lib.c:223:1: return from a call to BN_num_bits
  221.           return 0;
  222.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
  223. > }
  224.   
  225.   static void bn_free_d(BIGNUM *a)

crypto/ec/ec_ameth.c:374:5: 
372.   
373.       ret = BN_num_bits(order);
374. >     BN_free(order);
375.       return ret;
376.   }

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

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

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

crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
    963.   }
    964.   
    965. > int BN_get_flags(const BIGNUM *b, int n)
    966.   {
    967.       return b->flags & n;

crypto/bn/bn_lib.c:967:5: 
    965.   int BN_get_flags(const BIGNUM *b, int n)
    966.   {
    967. >     return b->flags & n;
    968.   }
    969.   

crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
    966.   {
    967.       return b->flags & n;
    968. > }
    969.   
    970.   /* Populate a BN_GENCB structure with an "old"-style callback */

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

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

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

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

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

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