crypto/rsa/rsa_sign.c:265: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 180, column 9 is not reachable after line 265, column 5.
Showing all 55 steps of the trace


crypto/rsa/rsa_sign.c:157:1: start of procedure int_rsa_verify()
155.   }
156.   
157. > int int_rsa_verify(int dtype, const unsigned char *m,
158.                      unsigned int m_len,
159.                      unsigned char *rm, size_t *prm_len,

crypto/rsa/rsa_sign.c:162:5: 
160.                      const unsigned char *sigbuf, size_t siglen, RSA *rsa)
161.   {
162. >     int i, ret = 0, sigtype;
163.       unsigned char *s;
164.       X509_SIG *sig = NULL;

crypto/rsa/rsa_sign.c:164:5: 
162.       int i, ret = 0, sigtype;
163.       unsigned char *s;
164. >     X509_SIG *sig = NULL;
165.   
166.       if (siglen != (unsigned int)RSA_size(rsa)) {

crypto/rsa/rsa_sign.c:166:9: 
164.       X509_SIG *sig = NULL;
165.   
166. >     if (siglen != (unsigned int)RSA_size(rsa)) {
167.           RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_WRONG_SIGNATURE_LENGTH);
168.           return (0);

crypto/rsa/rsa_crpt.c:71:1: start of procedure RSA_size()
  69.   }
  70.   
  71. > int RSA_size(const RSA *r)
  72.   {
  73.       return (BN_num_bytes(r->n));

crypto/rsa/rsa_crpt.c:73:5: 
  71.   int RSA_size(const RSA *r)
  72.   {
  73. >     return (BN_num_bytes(r->n));
  74.   }
  75.   

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

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

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

crypto/bn/bn_lib.c:975:1: start of procedure BN_is_zero()
      973.   }
      974.   
      975. > int BN_is_zero(const BIGNUM *a)
      976.   {
      977.       return a->top == 0;

crypto/bn/bn_lib.c:977:12: Condition is false
      975.   int BN_is_zero(const BIGNUM *a)
      976.   {
      977.       return a->top == 0;
                        ^
      978.   }
      979.   

crypto/bn/bn_lib.c:977:5: 
      975.   int BN_is_zero(const BIGNUM *a)
      976.   {
      977. >     return a->top == 0;
      978.   }
      979.   

crypto/bn/bn_lib.c:978:1: return from a call to BN_is_zero
      976.   {
      977.       return a->top == 0;
      978. > }
      979.   
      980.   int BN_is_one(const BIGNUM *a)

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

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

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

crypto/rsa/rsa_crpt.c:74:1: return from a call to RSA_size
  72.   {
  73.       return (BN_num_bytes(r->n));
  74. > }
  75.   
  76.   int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to,

crypto/rsa/rsa_sign.c:166:9: Taking false branch
164.       X509_SIG *sig = NULL;
165.   
166.       if (siglen != (unsigned int)RSA_size(rsa)) {
               ^
167.           RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_WRONG_SIGNATURE_LENGTH);
168.           return (0);

crypto/rsa/rsa_sign.c:171:10: Taking true branch
169.       }
170.   
171.       if ((dtype == NID_md5_sha1) && rm) {
                ^
172.           i = RSA_public_decrypt((int)siglen,
173.                                  sigbuf, rm, rsa, RSA_PKCS1_PADDING);

crypto/rsa/rsa_sign.c:171:36: Taking false branch
169.       }
170.   
171.       if ((dtype == NID_md5_sha1) && rm) {
                                          ^
172.           i = RSA_public_decrypt((int)siglen,
173.                                  sigbuf, rm, rsa, RSA_PKCS1_PADDING);

crypto/rsa/rsa_sign.c:180:5: 
178.       }
179.   
180. >     s = OPENSSL_malloc((unsigned int)siglen);
181.       if (s == NULL) {
182.           RSAerr(RSA_F_INT_RSA_VERIFY, ERR_R_MALLOC_FAILURE);

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 (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
  121.       void *ret = NULL;
  122.   
  123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  124.           return malloc_impl(num, file, line);
  125.   

crypto/mem.c:126:9: Taking false branch
  124.           return malloc_impl(num, file, line);
  125.   
  126.       if (num <= 0)
                 ^
  127.           return NULL;
  128.   

crypto/mem.c:129:5: 
  127.           return NULL;
  128.   
  129. >     allow_customize = 0;
  130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
  137.       }
  138.   #else
  139. >     (void)file;
  140.       (void)line;
  141.       ret = malloc(num);

crypto/mem.c:140:5: 
  138.   #else
  139.       (void)file;
  140. >     (void)line;
  141.       ret = malloc(num);
  142.   #endif

crypto/mem.c:141:5: 
  139.       (void)file;
  140.       (void)line;
  141. >     ret = malloc(num);
  142.   #endif
  143.   

crypto/mem.c:156:5: 
  154.   #endif
  155.   
  156. >     return ret;
  157.   }
  158.   

crypto/mem.c:157:1: return from a call to CRYPTO_malloc
  155.   
  156.       return ret;
  157. > }
  158.   
  159.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/rsa/rsa_sign.c:181:9: Taking false branch
179.   
180.       s = OPENSSL_malloc((unsigned int)siglen);
181.       if (s == NULL) {
               ^
182.           RSAerr(RSA_F_INT_RSA_VERIFY, ERR_R_MALLOC_FAILURE);
183.           goto err;

crypto/rsa/rsa_sign.c:185:10: Taking true branch
183.           goto err;
184.       }
185.       if ((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH)) {
                ^
186.           RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_INVALID_MESSAGE_LENGTH);
187.           goto err;

crypto/rsa/rsa_sign.c:185:37: Taking true branch
183.           goto err;
184.       }
185.       if ((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH)) {
                                           ^
186.           RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_INVALID_MESSAGE_LENGTH);
187.           goto err;

crypto/rsa/rsa_sign.c:186:9: Skipping ERR_put_error(): empty list of specs
184.       }
185.       if ((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH)) {
186.           RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_INVALID_MESSAGE_LENGTH);
               ^
187.           goto err;
188.       }

crypto/rsa/rsa_sign.c:263:2: 
261.               ret = 1;
262.       }
263. >  err:
264.       X509_SIG_free(sig);
265.       OPENSSL_clear_free(s, (unsigned int)siglen);

crypto/rsa/rsa_sign.c:264:5: 
262.       }
263.    err:
264. >     X509_SIG_free(sig);
265.       OPENSSL_clear_free(s, (unsigned int)siglen);
266.       return (ret);

crypto/asn1/x_sig.c:68:1: start of procedure X509_SIG_free()
  66.   } ASN1_SEQUENCE_END(X509_SIG)
  67.   
  68. > IMPLEMENT_ASN1_FUNCTIONS(X509_SIG)

crypto/asn1/tasn_fre.c:70:1: start of procedure ASN1_item_free()
    68.   /* Free up an ASN1 structure */
    69.   
    70. > void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
    71.   {
    72.       asn1_item_embed_free(&val, it, 0);

crypto/asn1/tasn_fre.c:72:5: Skipping asn1_item_embed_free(): empty list of specs
    70.   void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
    71.   {
    72.       asn1_item_embed_free(&val, it, 0);
              ^
    73.   }
    74.   

crypto/asn1/tasn_fre.c:73:1: return from a call to ASN1_item_free
    71.   {
    72.       asn1_item_embed_free(&val, it, 0);
    73. > }
    74.   
    75.   void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)

crypto/asn1/x_sig.c:68:1: return from a call to X509_SIG_free
  66.   } ASN1_SEQUENCE_END(X509_SIG)
  67.   
  68. > IMPLEMENT_ASN1_FUNCTIONS(X509_SIG)

crypto/rsa/rsa_sign.c:265:5: 
263.    err:
264.       X509_SIG_free(sig);
265. >     OPENSSL_clear_free(s, (unsigned int)siglen);
266.       return (ret);
267.   }

crypto/mem.c:245:1: start of procedure CRYPTO_clear_free()
  243.   }
  244.   
  245. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  246.   {
  247.       if (str == NULL)

crypto/mem.c:247:9: Taking false branch
  245.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  246.   {
  247.       if (str == NULL)
                 ^
  248.           return;
  249.       if (num)

crypto/mem.c:249:9: Taking true branch
  247.       if (str == NULL)
  248.           return;
  249.       if (num)
                 ^
  250.           OPENSSL_cleanse(str, num);
  251.       CRYPTO_free(str, file, line);

crypto/mem.c:250:9: Skipping OPENSSL_cleanse(): method has no implementation
  248.           return;
  249.       if (num)
  250.           OPENSSL_cleanse(str, num);
                 ^
  251.       CRYPTO_free(str, file, line);
  252.   }

crypto/mem.c:251:5: 
  249.       if (num)
  250.           OPENSSL_cleanse(str, num);
  251. >     CRYPTO_free(str, file, line);
  252.   }

crypto/mem.c:225:1: start of procedure CRYPTO_free()
    223.   }
    224.   
    225. > void CRYPTO_free(void *str, const char *file, int line)
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:227:9: Taking true branch
    225.   void CRYPTO_free(void *str, const char *file, int line)
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    228.           free_impl(str, file, line);
    229.           return;

crypto/mem.c:227:30: Taking true branch
    225.   void CRYPTO_free(void *str, const char *file, int line)
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    228.           free_impl(str, file, line);
    229.           return;

crypto/mem.c:228:9: Skipping __function_pointer__(): unresolved function pointer
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    228.           free_impl(str, file, line);
                   ^
    229.           return;
    230.       }

crypto/mem.c:229:9: 
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    228.           free_impl(str, file, line);
    229. >         return;
    230.       }
    231.   

crypto/mem.c:243:1: return from a call to CRYPTO_free
    241.       free(str);
    242.   #endif
    243. > }
    244.   
    245.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/mem.c:252:1: return from a call to CRYPTO_clear_free
  250.           OPENSSL_cleanse(str, num);
  251.       CRYPTO_free(str, file, line);
  252. > }
