Fixed memory leak.
authorBhanu Singh Rao <bhanu.singh@samsung.com>
Thu, 24 Oct 2013 15:24:47 +0000 (20:54 +0530)
committerBhanu Singh Rao <bhanu.singh@samsung.com>
Thu, 24 Oct 2013 15:24:47 +0000 (20:54 +0530)
Change-Id: I8ecdf4623e6e1f24c5391542deaf98afa90e7407
Signed-off-by: Bhanu Singh Rao <bhanu.singh@samsung.com>
src/security/cert/FSecCert_X509CertificateStoreImpl.cpp

index fdfe3a8..93a8645 100644 (file)
@@ -84,10 +84,16 @@ _X509CertificateStoreImpl::_X509CertificateStoreImpl(void)
 
 _X509CertificateStoreImpl::~_X509CertificateStoreImpl(void)
 {
-       if ((__certType > _CERT_TYPE_NOT_BOUNDED) && (__certType < _CERT_TYPE_MAX))
+       int prevIndex = GetIndexFromCertType(__certType);
+       if (__certType == _CERT_TYPE_USER_CERT)
        {
                __pCertServiceProxy->CloseCertificateStore(__certType);
        }
+       else if (prevIndex > -1 && __context[prevIndex] != 0)
+       {
+               _CertServer::CloseCertificateStore(reinterpret_cast< CertificateStoreCtx >(__context[prevIndex]));
+               __context[prevIndex] = 0;
+       }
 }
 
 result
@@ -552,4 +558,4 @@ InsertPkcs12Content(const char* pPath, const char* pPassword)
 }
 
 
-} } }     // Tizen::Security::Cert
+} } }      // Tizen::Security::Cert