crypto/cms/cms_env.c:584: error: UNINITIALIZED_VALUE
  The value read from ret was never initialized.
Showing all 1 steps of the trace


crypto/cms/cms_env.c:584:2: 
582.   		OPENSSL_free(ek);
583.   
584. > 	return ret;
585.   	}
586.   

static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms,
							CMS_RecipientInfo *ri)
	{
	CMS_KeyTransRecipientInfo *ktri = ri->d.ktri;
	EVP_PKEY_CTX *pctx = NULL;
	unsigned char *ek = NULL;
	size_t eklen;
	int ret;
	if (ktri->pkey == NULL)
		{
		CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT,
			CMS_R_NO_PRIVATE_KEY);
		return 0;
		}
	pctx = EVP_PKEY_CTX_new(ktri->pkey, NULL);
	if (!pctx)
		return 0;
	if (EVP_PKEY_decrypt_init(pctx) <= 0)
		goto err;
	if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DECRYPT,
				EVP_PKEY_CTRL_CMS_DECRYPT, 0, ri) <= 0)
		{
		CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT, CMS_R_CTRL_ERROR);
		goto err;
		}
	if (EVP_PKEY_decrypt(pctx, NULL, &eklen,
				ktri->encryptedKey->data,
				ktri->encryptedKey->length) <= 0)
		goto err;
	ek = OPENSSL_malloc(eklen);
	if (ek == NULL)
		{
		CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT,
							ERR_R_MALLOC_FAILURE);
		goto err;
		}
	if (EVP_PKEY_decrypt(pctx, ek, &eklen,
				ktri->encryptedKey->data,
				ktri->encryptedKey->length) <= 0)
		{
		CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT, CMS_R_CMS_LIB);
		goto err;
		}
	ret = 1;
	cms->d.envelopedData->encryptedContentInfo->key = ek;
	cms->d.envelopedData->encryptedContentInfo->keylen = eklen;
	err:
	if (pctx)
		EVP_PKEY_CTX_free(pctx);
	if (!ret && ek)
		OPENSSL_free(ek);
	return ret;
	}
['static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms,\n\t\t\t\t\t\t\tCMS_RecipientInfo *ri)\n\t{\n\tCMS_KeyTransRecipientInfo *ktri = ri->d.ktri;\n\tEVP_PKEY_CTX *pctx = NULL;\n\tunsigned char *ek = NULL;\n\tsize_t eklen;\n\tint ret;\n\tif (ktri->pkey == NULL)\n\t\t{\n\t\tCMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT,\n\t\t\tCMS_R_NO_PRIVATE_KEY);\n\t\treturn 0;\n\t\t}\n\tpctx = EVP_PKEY_CTX_new(ktri->pkey, NULL);\n\tif (!pctx)\n\t\treturn 0;\n\tif (EVP_PKEY_decrypt_init(pctx) <= 0)\n\t\tgoto err;\n\tif (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DECRYPT,\n\t\t\t\tEVP_PKEY_CTRL_CMS_DECRYPT, 0, ri) <= 0)\n\t\t{\n\t\tCMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT, CMS_R_CTRL_ERROR);\n\t\tgoto err;\n\t\t}\n\tif (EVP_PKEY_decrypt(pctx, NULL, &eklen,\n\t\t\t\tktri->encryptedKey->data,\n\t\t\t\tktri->encryptedKey->length) <= 0)\n\t\tgoto err;\n\tek = OPENSSL_malloc(eklen);\n\tif (ek == NULL)\n\t\t{\n\t\tCMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT,\n\t\t\t\t\t\t\tERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tif (EVP_PKEY_decrypt(pctx, ek, &eklen,\n\t\t\t\tktri->encryptedKey->data,\n\t\t\t\tktri->encryptedKey->length) <= 0)\n\t\t{\n\t\tCMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT, CMS_R_CMS_LIB);\n\t\tgoto err;\n\t\t}\n\tret = 1;\n\tcms->d.envelopedData->encryptedContentInfo->key = ek;\n\tcms->d.envelopedData->encryptedContentInfo->keylen = eklen;\n\terr:\n\tif (pctx)\n\t\tEVP_PKEY_CTX_free(pctx);\n\tif (!ret && ek)\n\t\tOPENSSL_free(ek);\n\treturn ret;\n\t}']