SysTryReturn(NID_SEC_CRYPTO, encryptedData.GetRemaining() > 0, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The specified input parameter is invalid.");
- r = __encryptionAlgorithm.Construct(algorithmId.GetAlgorithmObjectId(), algorithmId.GetParametersN());
+ std::unique_ptr< IAlgorithmParameters > pParam(algorithmId.GetParametersN());
+ SysTryReturn(NID_SEC_CRYPTO, pParam != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ r = __encryptionAlgorithm.Construct(algorithmId.GetAlgorithmObjectId(), pParam.get());
SysTryReturn(NID_SEC_CRYPTO, !IsFailed(r), r, r, "[%s] Failed to construct the algorithm identifier instance for encryption algorithm.", GetErrorMessage(r));
r = __encryptedData.Construct(encryptedData);