crypto/cms/cms_pwri.c:343: error: MEMORY_LEAK
  memory dynamically allocated to `kekctx` by call to `EVP_CIPHER_CTX_new()` at line 335, column 14 is not reachable after line 343, column 10.
Showing all 28 steps of the trace


crypto/cms/cms_pwri.c:320:1: start of procedure cms_RecipientInfo_pwri_crypt()
318.   /* Encrypt/Decrypt content key in PWRI recipient info */
319.   
320. > int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
321.                                    int en_de)
322.   {

crypto/cms/cms_pwri.c:325:5: 
323.       CMS_EncryptedContentInfo *ec;
324.       CMS_PasswordRecipientInfo *pwri;
325. >     int r = 0;
326.       X509_ALGOR *algtmp, *kekalg = NULL;
327.       EVP_CIPHER_CTX *kekctx;

crypto/cms/cms_pwri.c:326:5: 
324.       CMS_PasswordRecipientInfo *pwri;
325.       int r = 0;
326. >     X509_ALGOR *algtmp, *kekalg = NULL;
327.       EVP_CIPHER_CTX *kekctx;
328.       const EVP_CIPHER *kekcipher;

crypto/cms/cms_pwri.c:329:5: 
327.       EVP_CIPHER_CTX *kekctx;
328.       const EVP_CIPHER *kekcipher;
329. >     unsigned char *key = NULL;
330.       size_t keylen;
331.   

crypto/cms/cms_pwri.c:332:5: 
330.       size_t keylen;
331.   
332. >     ec = cms->d.envelopedData->encryptedContentInfo;
333.   
334.       pwri = ri->d.pwri;

crypto/cms/cms_pwri.c:334:5: 
332.       ec = cms->d.envelopedData->encryptedContentInfo;
333.   
334. >     pwri = ri->d.pwri;
335.       kekctx = EVP_CIPHER_CTX_new();
336.   

crypto/cms/cms_pwri.c:335:5: 
333.   
334.       pwri = ri->d.pwri;
335. >     kekctx = EVP_CIPHER_CTX_new();
336.   
337.       if (!pwri->pass) {

crypto/evp/evp_enc.c:93:1: start of procedure EVP_CIPHER_CTX_new()
  91.   }
  92.   
  93. > EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
  94.   {
  95.       return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));

crypto/evp/evp_enc.c:95:5: 
  93.   EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
  94.   {
  95. >     return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  96.   }
  97.   

crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
    155.   }
    156.   
    157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    158.   {
    159.       void *ret = CRYPTO_malloc(num, file, line);

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

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
      118.   }
      119.   
      120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122.       void *ret = NULL;

crypto/mem.c:122:5: 
      120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      121.   {
      122. >     void *ret = NULL;
      123.   
      124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
      122.       void *ret = NULL;
      123.   
      124.       if (num <= 0)
                     ^
      125.           return NULL;
      126.   

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

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

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

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

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

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

crypto/mem.c:161:9: Taking true branch
    159.       void *ret = CRYPTO_malloc(num, file, line);
    160.   
    161.       if (ret != NULL)
                   ^
    162.           memset(ret, 0, num);
    163.       return ret;

crypto/mem.c:162:9: 
    160.   
    161.       if (ret != NULL)
    162. >         memset(ret, 0, num);
    163.       return ret;
    164.   }

crypto/mem.c:163:5: 
    161.       if (ret != NULL)
    162.           memset(ret, 0, num);
    163. >     return ret;
    164.   }
    165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
    162.           memset(ret, 0, num);
    163.       return ret;
    164. > }
    165.   
    166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/evp_enc.c:96:1: return from a call to EVP_CIPHER_CTX_new
  94.   {
  95.       return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  96. > }
  97.   
  98.   void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)

crypto/cms/cms_pwri.c:337:10: Taking false branch
335.       kekctx = EVP_CIPHER_CTX_new();
336.   
337.       if (!pwri->pass) {
                ^
338.           CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT, CMS_R_NO_PASSWORD);
339.           return 0;

crypto/cms/cms_pwri.c:341:5: 
339.           return 0;
340.       }
341. >     algtmp = pwri->keyEncryptionAlgorithm;
342.   
343.       if (!algtmp || OBJ_obj2nid(algtmp->algorithm) != NID_id_alg_PWRI_KEK) {

crypto/cms/cms_pwri.c:343:10: Taking true branch
341.       algtmp = pwri->keyEncryptionAlgorithm;
342.   
343.       if (!algtmp || OBJ_obj2nid(algtmp->algorithm) != NID_id_alg_PWRI_KEK) {
                ^
344.           CMSerr(CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT,
345.                  CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM);
