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


crypto/rsa/rsa_sign.c:110:1: start of procedure int_rsa_verify()
108.   }
109.   
110. > int int_rsa_verify(int dtype, const unsigned char *m,
111.                      unsigned int m_len,
112.                      unsigned char *rm, size_t *prm_len,

crypto/rsa/rsa_sign.c:115:5: 
113.                      const unsigned char *sigbuf, size_t siglen, RSA *rsa)
114.   {
115. >     int i, ret = 0, sigtype;
116.       unsigned char *s;
117.       X509_SIG *sig = NULL;

crypto/rsa/rsa_sign.c:117:5: 
115.       int i, ret = 0, sigtype;
116.       unsigned char *s;
117. >     X509_SIG *sig = NULL;
118.   
119.       if (siglen != (unsigned int)RSA_size(rsa)) {

crypto/rsa/rsa_sign.c:119:9: 
117.       X509_SIG *sig = NULL;
118.   
119. >     if (siglen != (unsigned int)RSA_size(rsa)) {
120.           RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_WRONG_SIGNATURE_LENGTH);
121.           return (0);

crypto/rsa/rsa_crpt.c:23:1: start of procedure RSA_size()
  21.   }
  22.   
  23. > int RSA_size(const RSA *r)
  24.   {
  25.       return (BN_num_bytes(r->n));

crypto/rsa/rsa_crpt.c:25:5: 
  23.   int RSA_size(const RSA *r)
  24.   {
  25. >     return (BN_num_bytes(r->n));
  26.   }
  27.   

crypto/bn/bn_lib.c:161:1: start of procedure BN_num_bits()
    159.   }
    160.   
    161. > int BN_num_bits(const BIGNUM *a)
    162.   {
    163.       int i = a->top - 1;

crypto/bn/bn_lib.c:163:5: 
    161.   int BN_num_bits(const BIGNUM *a)
    162.   {
    163. >     int i = a->top - 1;
    164.       bn_check_top(a);
    165.   

crypto/bn/bn_lib.c:166:9: 
    164.       bn_check_top(a);
    165.   
    166. >     if (BN_is_zero(a))
    167.           return 0;
    168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:918:1: start of procedure BN_is_zero()
      916.   }
      917.   
      918. > int BN_is_zero(const BIGNUM *a)
      919.   {
      920.       return a->top == 0;

crypto/bn/bn_lib.c:920:12: Condition is false
      918.   int BN_is_zero(const BIGNUM *a)
      919.   {
      920.       return a->top == 0;
                        ^
      921.   }
      922.   

crypto/bn/bn_lib.c:920:5: 
      918.   int BN_is_zero(const BIGNUM *a)
      919.   {
      920. >     return a->top == 0;
      921.   }
      922.   

crypto/bn/bn_lib.c:921:1: return from a call to BN_is_zero
      919.   {
      920.       return a->top == 0;
      921. > }
      922.   
      923.   int BN_is_one(const BIGNUM *a)

crypto/bn/bn_lib.c:166:9: Taking false branch
    164.       bn_check_top(a);
    165.   
    166.       if (BN_is_zero(a))
                   ^
    167.           return 0;
    168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));

crypto/bn/bn_lib.c:168:5: Skipping BN_num_bits_word(): empty list of specs
    166.       if (BN_is_zero(a))
    167.           return 0;
    168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
               ^
    169.   }
    170.   

crypto/bn/bn_lib.c:169:1: return from a call to BN_num_bits
    167.           return 0;
    168.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
    169. > }
    170.   
    171.   static void bn_free_d(BIGNUM *a)

crypto/rsa/rsa_crpt.c:26:1: return from a call to RSA_size
  24.   {
  25.       return (BN_num_bytes(r->n));
  26. > }
  27.   
  28.   int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to,

crypto/rsa/rsa_sign.c:119:9: Taking false branch
117.       X509_SIG *sig = NULL;
118.   
119.       if (siglen != (unsigned int)RSA_size(rsa)) {
               ^
120.           RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_WRONG_SIGNATURE_LENGTH);
121.           return (0);

crypto/rsa/rsa_sign.c:124:10: Taking true branch
122.       }
123.   
124.       if ((dtype == NID_md5_sha1) && rm) {
                ^
125.           i = RSA_public_decrypt((int)siglen,
126.                                  sigbuf, rm, rsa, RSA_PKCS1_PADDING);

crypto/rsa/rsa_sign.c:124:36: Taking false branch
122.       }
123.   
124.       if ((dtype == NID_md5_sha1) && rm) {
                                          ^
125.           i = RSA_public_decrypt((int)siglen,
126.                                  sigbuf, rm, rsa, RSA_PKCS1_PADDING);

crypto/rsa/rsa_sign.c:133:5: 
131.       }
132.   
133. >     s = OPENSSL_malloc((unsigned int)siglen);
134.       if (s == NULL) {
135.           RSAerr(RSA_F_INT_RSA_VERIFY, ERR_R_MALLOC_FAILURE);

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/rsa/rsa_sign.c:134:9: Taking false branch
132.   
133.       s = OPENSSL_malloc((unsigned int)siglen);
134.       if (s == NULL) {
               ^
135.           RSAerr(RSA_F_INT_RSA_VERIFY, ERR_R_MALLOC_FAILURE);
136.           goto err;

crypto/rsa/rsa_sign.c:138:10: Taking true branch
136.           goto err;
137.       }
138.       if ((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH)) {
                ^
139.           RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_INVALID_MESSAGE_LENGTH);
140.           goto err;

crypto/rsa/rsa_sign.c:138:37: Taking true branch
136.           goto err;
137.       }
138.       if ((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH)) {
                                           ^
139.           RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_INVALID_MESSAGE_LENGTH);
140.           goto err;

crypto/rsa/rsa_sign.c:139:9: Skipping ERR_put_error(): empty list of specs
137.       }
138.       if ((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH)) {
139.           RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_INVALID_MESSAGE_LENGTH);
               ^
140.           goto err;
141.       }

crypto/rsa/rsa_sign.c:211:2: 
209.               ret = 1;
210.       }
211. >  err:
212.       X509_SIG_free(sig);
213.       OPENSSL_clear_free(s, (unsigned int)siglen);

crypto/rsa/rsa_sign.c:212:5: 
210.       }
211.    err:
212. >     X509_SIG_free(sig);
213.       OPENSSL_clear_free(s, (unsigned int)siglen);
214.       return (ret);

crypto/asn1/x_sig.c:21:1: start of procedure X509_SIG_free()
  19.   } ASN1_SEQUENCE_END(X509_SIG)
  20.   
  21. > IMPLEMENT_ASN1_FUNCTIONS(X509_SIG)
  22.   
  23.   void X509_SIG_get0(X509_ALGOR **palg, ASN1_OCTET_STRING **pdigest,

crypto/asn1/tasn_fre.c:21:1: start of procedure ASN1_item_free()
    19.   /* Free up an ASN1 structure */
    20.   
    21. > void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
    22.   {
    23.       asn1_item_embed_free(&val, it, 0);

crypto/asn1/tasn_fre.c:23:5: Skipping asn1_item_embed_free(): empty list of specs
    21.   void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
    22.   {
    23.       asn1_item_embed_free(&val, it, 0);
              ^
    24.   }
    25.   

crypto/asn1/tasn_fre.c:24:1: return from a call to ASN1_item_free
    22.   {
    23.       asn1_item_embed_free(&val, it, 0);
    24. > }
    25.   
    26.   void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)

crypto/asn1/x_sig.c:21:1: return from a call to X509_SIG_free
  19.   } ASN1_SEQUENCE_END(X509_SIG)
  20.   
  21. > IMPLEMENT_ASN1_FUNCTIONS(X509_SIG)
  22.   
  23.   void X509_SIG_get0(X509_ALGOR **palg, ASN1_OCTET_STRING **pdigest,

crypto/rsa/rsa_sign.c:213:5: 
211.    err:
212.       X509_SIG_free(sig);
213. >     OPENSSL_clear_free(s, (unsigned int)siglen);
214.       return (ret);
215.   }

crypto/mem.c:183:1: start of procedure CRYPTO_clear_free()
  181.   }
  182.   
  183. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  184.   {
  185.       if (str == NULL)

crypto/mem.c:185:9: Taking false branch
  183.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  184.   {
  185.       if (str == NULL)
                 ^
  186.           return;
  187.       if (num)

crypto/mem.c:187:9: Taking true branch
  185.       if (str == NULL)
  186.           return;
  187.       if (num)
                 ^
  188.           OPENSSL_cleanse(str, num);
  189.       CRYPTO_free(str, file, line);

crypto/mem.c:188:9: Skipping OPENSSL_cleanse(): method has no implementation
  186.           return;
  187.       if (num)
  188.           OPENSSL_cleanse(str, num);
                 ^
  189.       CRYPTO_free(str, file, line);
  190.   }

crypto/mem.c:189:5: 
  187.       if (num)
  188.           OPENSSL_cleanse(str, num);
  189. >     CRYPTO_free(str, file, line);
  190.   }

crypto/mem.c:163:1: start of procedure CRYPTO_free()
    161.   }
    162.   
    163. > void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:165:9: Taking true branch
    163.   void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    166.           free_impl(str, file, line);
    167.           return;

crypto/mem.c:165:30: Taking true branch
    163.   void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    166.           free_impl(str, file, line);
    167.           return;

crypto/mem.c:166:9: Skipping __function_pointer__(): unresolved function pointer
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    166.           free_impl(str, file, line);
                   ^
    167.           return;
    168.       }

crypto/mem.c:167:9: 
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    166.           free_impl(str, file, line);
    167. >         return;
    168.       }
    169.   

crypto/mem.c:181:1: return from a call to CRYPTO_free
    179.       free(str);
    180.   #endif
    181. > }
    182.   
    183.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

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