crypto/bn/bn_mpi.c:121: error: MEMORY_LEAK
  memory dynamically allocated to `return` by call to `BN_new()` at line 108, column 13 is not reachable after line 121, column 9.
Showing all 34 steps of the trace


crypto/bn/bn_mpi.c:91:1: start of procedure BN_mpi2bn()
89.   }
90.   
91. > BIGNUM *BN_mpi2bn(const unsigned char *d, int n, BIGNUM *a)
92.   {
93.       long len;

crypto/bn/bn_mpi.c:94:5: 
92.   {
93.       long len;
94. >     int neg = 0;
95.   
96.       if (n < 4) {

crypto/bn/bn_mpi.c:96:9: Taking false branch
94.       int neg = 0;
95.   
96.       if (n < 4) {
              ^
97.           BNerr(BN_F_BN_MPI2BN, BN_R_INVALID_LENGTH);
98.           return (NULL);

crypto/bn/bn_mpi.c:100:5: 
98.           return (NULL);
99.       }
100. >     len = ((long)d[0] << 24) | ((long)d[1] << 16) | ((int)d[2] << 8) | (int)
101.           d[3];
102.       if ((len + 4) != n) {

crypto/bn/bn_mpi.c:102:9: Taking false branch
100.       len = ((long)d[0] << 24) | ((long)d[1] << 16) | ((int)d[2] << 8) | (int)
101.           d[3];
102.       if ((len + 4) != n) {
               ^
103.           BNerr(BN_F_BN_MPI2BN, BN_R_ENCODING_ERROR);
104.           return (NULL);

crypto/bn/bn_mpi.c:107:9: Taking true branch
105.       }
106.   
107.       if (a == NULL)
               ^
108.           a = BN_new();
109.       if (a == NULL)

crypto/bn/bn_mpi.c:108:9: 
106.   
107.       if (a == NULL)
108. >         a = BN_new();
109.       if (a == NULL)
110.           return (NULL);

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.   #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/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/bn/bn_mpi.c:109:9: Taking false branch
107.       if (a == NULL)
108.           a = BN_new();
109.       if (a == NULL)
               ^
110.           return (NULL);
111.   

crypto/bn/bn_mpi.c:112:9: Taking false branch
110.           return (NULL);
111.   
112.       if (len == 0) {
               ^
113.           a->neg = 0;
114.           a->top = 0;

crypto/bn/bn_mpi.c:117:5: 
115.           return (a);
116.       }
117. >     d += 4;
118.       if ((*d) & 0x80)
119.           neg = 1;

crypto/bn/bn_mpi.c:118:9: Taking false branch
116.       }
117.       d += 4;
118.       if ((*d) & 0x80)
               ^
119.           neg = 1;
120.       if (BN_bin2bn(d, (int)len, a) == NULL)

crypto/bn/bn_mpi.c:120:9: Taking true branch
118.       if ((*d) & 0x80)
119.           neg = 1;
120.       if (BN_bin2bn(d, (int)len, a) == NULL)
               ^
121.           return (NULL);
122.       a->neg = neg;

crypto/bn/bn_mpi.c:121:9: 
119.           neg = 1;
120.       if (BN_bin2bn(d, (int)len, a) == NULL)
121. >         return (NULL);
122.       a->neg = neg;
123.       if (neg) {
