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 43 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:158:1: start of procedure CRYPTO_malloc()
  156.   #endif
  157.   
  158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  159.   {
  160.       void *ret = NULL;

crypto/mem.c:160:5: 
  158.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  159.   {
  160. >     void *ret = NULL;
  161.   
  162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:162:9: Taking false branch
  160.       void *ret = NULL;
  161.   
  162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  163.           return malloc_impl(num, file, line);
  164.   

crypto/mem.c:165:9: Taking false branch
  163.           return malloc_impl(num, file, line);
  164.   
  165.       if (num <= 0)
                 ^
  166.           return NULL;
  167.   

crypto/mem.c:169:5: 
  167.   
  168.       FAILTEST();
  169. >     allow_customize = 0;
  170.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  171.       if (call_malloc_debug) {

crypto/mem.c:179:5: 
  177.       }
  178.   #else
  179. >     osslargused(file); osslargused(line);
  180.       ret = malloc(num);
  181.   #endif

crypto/mem.c:179:24: 
  177.       }
  178.   #else
  179. >     osslargused(file); osslargused(line);
  180.       ret = malloc(num);
  181.   #endif

crypto/mem.c:180:5: 
  178.   #else
  179.       osslargused(file); osslargused(line);
  180. >     ret = malloc(num);
  181.   #endif
  182.   

crypto/mem.c:183:5: 
  181.   #endif
  182.   
  183. >     return ret;
  184.   }
  185.   

crypto/mem.c:184:1: return from a call to CRYPTO_malloc
  182.   
  183.       return ret;
  184. > }
  185.   
  186.   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:416:1: start of procedure EVP_DecryptUpdate()
  414.   }
  415.   
  416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
  417.                         const unsigned char *in, int inl)
  418.   {

crypto/evp/evp_enc.c:422:5: 
  420.       unsigned int b;
  421.   
  422. >     b = ctx->cipher->block_size;
  423.   
  424.       if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {

crypto/evp/evp_enc.c:424:9: Taking false branch
  422.       b = ctx->cipher->block_size;
  423.   
  424.       if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
                 ^
  425.           if (b == 1 && is_partially_overlapping(out, in, inl)) {
  426.               EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);

crypto/evp/evp_enc.c:439:9: Taking false branch
  437.       }
  438.   
  439.       if (inl <= 0) {
                 ^
  440.           *outl = 0;
  441.           return inl == 0;

crypto/evp/evp_enc.c:444:9: Taking true branch
  442.       }
  443.   
  444.       if (ctx->flags & EVP_CIPH_NO_PADDING)
                 ^
  445.           return EVP_EncryptUpdate(ctx, out, outl, in, inl);
  446.   

crypto/evp/evp_enc.c:445:9: Skipping EVP_EncryptUpdate(): empty list of specs
  443.   
  444.       if (ctx->flags & EVP_CIPH_NO_PADDING)
  445.           return EVP_EncryptUpdate(ctx, out, outl, in, inl);
                 ^
  446.   
  447.       OPENSSL_assert(b <= sizeof ctx->final);

crypto/evp/evp_enc.c:480:1: return from a call to EVP_DecryptUpdate
  478.   
  479.       return 1;
  480. > }
  481.   
  482.   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:273:1: start of procedure CRYPTO_clear_free()
  271.   }
  272.   
  273. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  274.   {
  275.       if (str == NULL)

crypto/mem.c:275:9: Taking false branch
  273.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  274.   {
  275.       if (str == NULL)
                 ^
  276.           return;
  277.       if (num)

crypto/mem.c:277:9: Taking true branch
  275.       if (str == NULL)
  276.           return;
  277.       if (num)
                 ^
  278.           OPENSSL_cleanse(str, num);
  279.       CRYPTO_free(str, file, line);

crypto/mem.c:278:9: Skipping OPENSSL_cleanse(): method has no implementation
  276.           return;
  277.       if (num)
  278.           OPENSSL_cleanse(str, num);
                 ^
  279.       CRYPTO_free(str, file, line);
  280.   }

crypto/mem.c:279:5: 
  277.       if (num)
  278.           OPENSSL_cleanse(str, num);
  279. >     CRYPTO_free(str, file, line);
  280.   }

crypto/mem.c:253:1: start of procedure CRYPTO_free()
    251.   }
    252.   
    253. > void CRYPTO_free(void *str, const char *file, int line)
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:255:9: Taking true branch
    253.   void CRYPTO_free(void *str, const char *file, int line)
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    256.           free_impl(str, file, line);
    257.           return;

crypto/mem.c:255:30: Taking true branch
    253.   void CRYPTO_free(void *str, const char *file, int line)
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    256.           free_impl(str, file, line);
    257.           return;

crypto/mem.c:256:9: Skipping __function_pointer__(): unresolved function pointer
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    256.           free_impl(str, file, line);
                   ^
    257.           return;
    258.       }

crypto/mem.c:257:9: 
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    256.           free_impl(str, file, line);
    257. >         return;
    258.       }
    259.   

crypto/mem.c:271:1: return from a call to CRYPTO_free
    269.       free(str);
    270.   #endif
    271. > }
    272.   
    273.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

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