crypto/cms/cms_pwri.c:225: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 191, column 11 is not reachable after line 225, column 5.
Showing all 49 steps of the trace


crypto/cms/cms_pwri.c:176:1: start of procedure kek_unwrap_key()
174.    */
175.   
176. > static int kek_unwrap_key(unsigned char *out, size_t *outlen,
177.                             const unsigned char *in, size_t inlen,
178.                             EVP_CIPHER_CTX *ctx)

crypto/cms/cms_pwri.c:180:5: 
178.                             EVP_CIPHER_CTX *ctx)
179.   {
180. >     size_t blocklen = EVP_CIPHER_CTX_block_size(ctx);
181.       unsigned char *tmp;
182.       int outl, rv = 0;

crypto/evp/evp_lib.c:170:1: start of procedure EVP_CIPHER_CTX_block_size()
  168.   }
  169.   
  170. > int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)
  171.   {
  172.       return ctx->cipher->block_size;

crypto/evp/evp_lib.c:172:5: 
  170.   int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)
  171.   {
  172. >     return ctx->cipher->block_size;
  173.   }
  174.   

crypto/evp/evp_lib.c:173:1: return from a call to EVP_CIPHER_CTX_block_size
  171.   {
  172.       return ctx->cipher->block_size;
  173. > }
  174.   
  175.   int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *e)

crypto/cms/cms_pwri.c:182:5: 
180.       size_t blocklen = EVP_CIPHER_CTX_block_size(ctx);
181.       unsigned char *tmp;
182. >     int outl, rv = 0;
183.       if (inlen < 2 * blocklen) {
184.           /* too small */

crypto/cms/cms_pwri.c:183:9: Taking false branch
181.       unsigned char *tmp;
182.       int outl, rv = 0;
183.       if (inlen < 2 * blocklen) {
               ^
184.           /* too small */
185.           return 0;

crypto/cms/cms_pwri.c:187:9: Taking false branch
185.           return 0;
186.       }
187.       if (inlen % blocklen) {
               ^
188.           /* Invalid size */
189.           return 0;

crypto/cms/cms_pwri.c:191:5: 
189.           return 0;
190.       }
191. >     tmp = OPENSSL_malloc(inlen);
192.       if (tmp == NULL)
193.           return 0;

crypto/mem.c:169:1: start of procedure CRYPTO_malloc()
  167.   #endif
  168.   
  169. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  170.   {
  171.       void *ret = NULL;

crypto/mem.c:171:5: 
  169.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  170.   {
  171. >     void *ret = NULL;
  172.   
  173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:173:9: Taking false branch
  171.       void *ret = NULL;
  172.   
  173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  174.           return malloc_impl(num, file, line);
  175.   

crypto/mem.c:176:9: Taking false branch
  174.           return malloc_impl(num, file, line);
  175.   
  176.       if (num == 0)
                 ^
  177.           return NULL;
  178.   

crypto/mem.c:180:5: 
  178.   
  179.       FAILTEST();
  180. >     allow_customize = 0;
  181.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  182.       if (call_malloc_debug) {

crypto/mem.c:190:5: 
  188.       }
  189.   #else
  190. >     osslargused(file); osslargused(line);
  191.       ret = malloc(num);
  192.   #endif

crypto/mem.c:190:24: 
  188.       }
  189.   #else
  190. >     osslargused(file); osslargused(line);
  191.       ret = malloc(num);
  192.   #endif

crypto/mem.c:191:5: 
  189.   #else
  190.       osslargused(file); osslargused(line);
  191. >     ret = malloc(num);
  192.   #endif
  193.   

crypto/mem.c:194:5: 
  192.   #endif
  193.   
  194. >     return ret;
  195.   }
  196.   

crypto/mem.c:195:1: return from a call to CRYPTO_malloc
  193.   
  194.       return ret;
  195. > }
  196.   
  197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/cms/cms_pwri.c:192:9: Taking false branch
190.       }
191.       tmp = OPENSSL_malloc(inlen);
192.       if (tmp == NULL)
               ^
193.           return 0;
194.       /* setup IV by decrypting last two blocks */

crypto/cms/cms_pwri.c:195:10: 
193.           return 0;
194.       /* setup IV by decrypting last two blocks */
195. >     if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
196.                              in + inlen - 2 * blocklen, blocklen * 2)
197.           /*

crypto/evp/evp_enc.c:421:1: start of procedure EVP_DecryptUpdate()
  419.   }
  420.   
  421. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
  422.                         const unsigned char *in, int inl)
  423.   {

crypto/evp/evp_enc.c:424:5: 
  422.                         const unsigned char *in, int inl)
  423.   {
  424. >     int fix_len, cmpl = inl;
  425.       unsigned int b;
  426.   

crypto/evp/evp_enc.c:427:5: 
  425.       unsigned int b;
  426.   
  427. >     b = ctx->cipher->block_size;
  428.   
  429.       if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))

crypto/evp/evp_enc.c:429:9: 
  427.       b = ctx->cipher->block_size;
  428.   
  429. >     if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
  430.           cmpl = (cmpl + 7) / 8;
  431.   

crypto/evp/evp_lib.c:494:1: start of procedure EVP_CIPHER_CTX_test_flags()
    492.   }
    493.   
    494. > int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags)
    495.   {
    496.       return (ctx->flags & flags);

crypto/evp/evp_lib.c:496:5: 
    494.   int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags)
    495.   {
    496. >     return (ctx->flags & flags);
    497.   }

crypto/evp/evp_lib.c:497:1: return from a call to EVP_CIPHER_CTX_test_flags
    495.   {
    496.       return (ctx->flags & flags);
    497. > }

crypto/evp/evp_enc.c:429:9: Taking false branch
  427.       b = ctx->cipher->block_size;
  428.   
  429.       if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
                 ^
  430.           cmpl = (cmpl + 7) / 8;
  431.   

crypto/evp/evp_enc.c:432:9: Taking false branch
  430.           cmpl = (cmpl + 7) / 8;
  431.   
  432.       if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
                 ^
  433.           if (b == 1 && is_partially_overlapping(out, in, cmpl)) {
  434.               EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);

crypto/evp/evp_enc.c:447:9: Taking false branch
  445.       }
  446.   
  447.       if (inl <= 0) {
                 ^
  448.           *outl = 0;
  449.           return inl == 0;

crypto/evp/evp_enc.c:452:9: Taking true branch
  450.       }
  451.   
  452.       if (ctx->flags & EVP_CIPH_NO_PADDING)
                 ^
  453.           return EVP_EncryptUpdate(ctx, out, outl, in, inl);
  454.   

crypto/evp/evp_enc.c:453:9: Skipping EVP_EncryptUpdate(): empty list of specs
  451.   
  452.       if (ctx->flags & EVP_CIPH_NO_PADDING)
  453.           return EVP_EncryptUpdate(ctx, out, outl, in, inl);
                 ^
  454.   
  455.       OPENSSL_assert(b <= sizeof ctx->final);

crypto/evp/evp_enc.c:488:1: return from a call to EVP_DecryptUpdate
  486.   
  487.       return 1;
  488. > }
  489.   
  490.   int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)

crypto/cms/cms_pwri.c:195:10: Taking true branch
193.           return 0;
194.       /* setup IV by decrypting last two blocks */
195.       if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
                ^
196.                              in + inlen - 2 * blocklen, blocklen * 2)
197.           /*

crypto/cms/cms_pwri.c:224:2: 
222.       memcpy(out, tmp + 4, *outlen);
223.       rv = 1;
224. >  err:
225.       OPENSSL_clear_free(tmp, inlen);
226.       return rv;

crypto/cms/cms_pwri.c:225:5: 
223.       rv = 1;
224.    err:
225. >     OPENSSL_clear_free(tmp, inlen);
226.       return rv;
227.   

crypto/mem.c:284:1: start of procedure CRYPTO_clear_free()
  282.   }
  283.   
  284. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  285.   {
  286.       if (str == NULL)

crypto/mem.c:286:9: Taking false branch
  284.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  285.   {
  286.       if (str == NULL)
                 ^
  287.           return;
  288.       if (num)

crypto/mem.c:288:9: Taking true branch
  286.       if (str == NULL)
  287.           return;
  288.       if (num)
                 ^
  289.           OPENSSL_cleanse(str, num);
  290.       CRYPTO_free(str, file, line);

crypto/mem.c:289:9: Skipping OPENSSL_cleanse(): method has no implementation
  287.           return;
  288.       if (num)
  289.           OPENSSL_cleanse(str, num);
                 ^
  290.       CRYPTO_free(str, file, line);
  291.   }

crypto/mem.c:290:5: 
  288.       if (num)
  289.           OPENSSL_cleanse(str, num);
  290. >     CRYPTO_free(str, file, line);
  291.   }

crypto/mem.c:264:1: start of procedure CRYPTO_free()
    262.   }
    263.   
    264. > void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:266:9: Taking true branch
    264.   void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    267.           free_impl(str, file, line);
    268.           return;

crypto/mem.c:266:30: Taking true branch
    264.   void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    267.           free_impl(str, file, line);
    268.           return;

crypto/mem.c:267:9: Skipping __function_pointer__(): unresolved function pointer
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    267.           free_impl(str, file, line);
                   ^
    268.           return;
    269.       }

crypto/mem.c:268:9: 
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    267.           free_impl(str, file, line);
    268. >         return;
    269.       }
    270.   

crypto/mem.c:282:1: return from a call to CRYPTO_free
    280.       free(str);
    281.   #endif
    282. > }
    283.   
    284.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

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