[SECURITY] Fixed valgrind tool issues
authorAnju <anju.ramani@samsung.com>
Mon, 15 Jul 2013 11:25:18 +0000 (16:55 +0530)
committerKyungwooNoh <kw1004.noh@samsung.com>
Mon, 15 Jul 2013 11:50:15 +0000 (20:50 +0900)
Change-Id: Iaadef926676173b19c0812cb473caffae7aa63b1
Signed-off-by: Anju <anju.ramani@samsung.com>
src/security/pkcs/FSecPkcs_Pkcs08AttributeImpl.cpp
src/security/pkcs/FSecPkcs_Pkcs08EncryptedPrivateKeyInfoImpl.cpp
src/security/pkcs/FSecPkcs_Pkcs08PrivateKeyInfoImpl.cpp

index 5234ef7..e796141 100644 (file)
@@ -50,6 +50,8 @@ _Pkcs08AttributeImpl::_Pkcs08AttributeImpl(void)
 
 _Pkcs08AttributeImpl::~_Pkcs08AttributeImpl(void)
 {
+       if (__attributeValues.GetCount() > 0)
+               __attributeValues.RemoveAll();
        //do nothing
 }
 
index 9a28344..c4c68fc 100644 (file)
@@ -139,7 +139,10 @@ _Pkcs08EncryptedPrivateKeyInfoImpl::Construct(const AlgorithmIdentifier& algorit
 
        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);
index 8f2ae40..3fff4e1 100644 (file)
@@ -54,6 +54,8 @@ _Pkcs08PrivateKeyInfoImpl::_Pkcs08PrivateKeyInfoImpl(void)
 //Default Destructor
 _Pkcs08PrivateKeyInfoImpl::~_Pkcs08PrivateKeyInfoImpl(void)
 {
+       if (__attributes.GetCount() > 0)
+               __attributes.RemoveAll();
        //do nothing
 }