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 36 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:189:1: start of procedure CRYPTO_malloc()
  187.   #endif
  188.   
  189. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  190.   {
  191.       void *ret = NULL;

crypto/mem.c:191:5: 
  189.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  190.   {
  191. >     void *ret = NULL;
  192.   
  193.       INCREMENT(malloc_count);

crypto/mem.c:194:9: Taking false branch
  192.   
  193.       INCREMENT(malloc_count);
  194.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  195.           return malloc_impl(num, file, line);
  196.   

crypto/mem.c:197:9: Taking false branch
  195.           return malloc_impl(num, file, line);
  196.   
  197.       if (num == 0)
                 ^
  198.           return NULL;
  199.   

crypto/mem.c:201:5: 
  199.   
  200.       FAILTEST();
  201. >     allow_customize = 0;
  202.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  203.       if (call_malloc_debug) {

crypto/mem.c:211:5: 
  209.       }
  210.   #else
  211. >     (void)(file); (void)(line);
  212.       ret = malloc(num);
  213.   #endif

crypto/mem.c:211:19: 
  209.       }
  210.   #else
  211. >     (void)(file); (void)(line);
  212.       ret = malloc(num);
  213.   #endif

crypto/mem.c:212:5: 
  210.   #else
  211.       (void)(file); (void)(line);
  212. >     ret = malloc(num);
  213.   #endif
  214.   

crypto/mem.c:215:5: 
  213.   #endif
  214.   
  215. >     return ret;
  216.   }
  217.   

crypto/mem.c:216:1: return from a call to CRYPTO_malloc
  214.   
  215.       return ret;
  216. > }
  217.   
  218.   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: Taking false 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:202:13: Taking true branch
200.            * this works because buffer is at least two block lengths long.
201.            */
202.           || !EVP_DecryptUpdate(ctx, tmp, &outl,
                   ^
203.                                 tmp + inlen - blocklen, blocklen)
204.           /* Can now decrypt first n - 1 blocks */

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:307:1: start of procedure CRYPTO_clear_free()
  305.   }
  306.   
  307. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  308.   {
  309.       if (str == NULL)

crypto/mem.c:309:9: Taking false branch
  307.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  308.   {
  309.       if (str == NULL)
                 ^
  310.           return;
  311.       if (num)

crypto/mem.c:311:9: Taking true branch
  309.       if (str == NULL)
  310.           return;
  311.       if (num)
                 ^
  312.           OPENSSL_cleanse(str, num);
  313.       CRYPTO_free(str, file, line);

crypto/mem.c:312:9: Skipping OPENSSL_cleanse(): method has no implementation
  310.           return;
  311.       if (num)
  312.           OPENSSL_cleanse(str, num);
                 ^
  313.       CRYPTO_free(str, file, line);
  314.   }

crypto/mem.c:313:5: 
  311.       if (num)
  312.           OPENSSL_cleanse(str, num);
  313. >     CRYPTO_free(str, file, line);
  314.   }

crypto/mem.c:286:1: start of procedure CRYPTO_free()
    284.   }
    285.   
    286. > void CRYPTO_free(void *str, const char *file, int line)
    287.   {
    288.       INCREMENT(free_count);

crypto/mem.c:289:9: Taking true branch
    287.   {
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    290.           free_impl(str, file, line);
    291.           return;

crypto/mem.c:289:30: Taking true branch
    287.   {
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    290.           free_impl(str, file, line);
    291.           return;

crypto/mem.c:290:9: Skipping __function_pointer__(): unresolved function pointer
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    290.           free_impl(str, file, line);
                   ^
    291.           return;
    292.       }

crypto/mem.c:291:9: 
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    290.           free_impl(str, file, line);
    291. >         return;
    292.       }
    293.   

crypto/mem.c:305:1: return from a call to CRYPTO_free
    303.       free(str);
    304.   #endif
    305. > }
    306.   
    307.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

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