diff options
author | Dongeup Ham <dongeup.ham@samsung.com> | 2012-12-27 13:58:15 +0900 |
---|---|---|
committer | Dongeup Ham <dongeup.ham@samsung.com> | 2012-12-27 13:58:15 +0900 |
commit | eb04667e6caaf20a7016ec9122ba9b54a2ed7b2d (patch) | |
tree | 669bbb9a4fad38b1252dc8da3caa6d08df0f1589 /src | |
parent | 7111af69a59fcfebeef7248b96f76c6e8f0a1eac (diff) | |
download | installer-eb04667e6caaf20a7016ec9122ba9b54a2ed7b2d.tar.gz installer-eb04667e6caaf20a7016ec9122ba9b54a2ed7b2d.tar.bz2 installer-eb04667e6caaf20a7016ec9122ba9b54a2ed7b2d.zip |
Prevent issues are fixed.
Change-Id: I2fb8620fa55a66b3cfca69bc42837bf305bdb1f3
Signed-off-by: Dongeup Ham <dongeup.ham@samsung.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/Context/InstallationContext.cpp | 16 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Installer/DirectoryInstaller.cpp | 4 | ||||
-rwxr-xr-x | src/Manager/ConfigurationManager.cpp | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Manager/InstallerManager.cpp | 16 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Manager/SignatureManager.cpp | 10 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Step/SignatureStep.cpp | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | src/Step/UnpackStep.cpp | 2 | ||||
-rwxr-xr-x | src/Util/InstallerUtil.cpp | 8 | ||||
-rwxr-xr-x | src/XmlHandler/ManifestGenerator.cpp | 4 | ||||
-rwxr-xr-x | src/XmlHandler/ManifestHandler.cpp | 68 | ||||
-rwxr-xr-x[-rw-r--r--] | src/XmlHandler/PrivilegeHandler.cpp | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | src/XmlHandler/SignatureHandler.cpp | 8 | ||||
-rwxr-xr-x | src/XmlHandler/XmlAttribute.cpp | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | src/XmlHandler/XmlHandler.cpp | 4 | ||||
-rwxr-xr-x | src/XmlHandler/XmlWriter.cpp | 37 |
15 files changed, 113 insertions, 98 deletions
diff --git a/src/Context/InstallationContext.cpp b/src/Context/InstallationContext.cpp index 8b7ba76..34adf81 100755 --- a/src/Context/InstallationContext.cpp +++ b/src/Context/InstallationContext.cpp @@ -127,42 +127,42 @@ InstallationContext::ChangeStep(InstallationStep step) break; case INSTALLER_STEP_CHECK_SYSTEM: - __pStep = new SystemCheckStep(); + __pStep = new (std::nothrow) SystemCheckStep(); TryReturn(__pStep, false, "[osp-installer] SystemCheckStep is failed."); break; case INSTALLER_STEP_CHECK_PACKAGE: - __pStep = new PackageCheckStep(); + __pStep = new (std::nothrow) PackageCheckStep(); TryReturn(__pStep, false, "[osp-installer] PackageCheckStep is failed."); break; case INSTALLER_STEP_UNPACK: - __pStep = new UnpackStep(); + __pStep = new (std::nothrow) UnpackStep(); TryReturn(__pStep, false, "[osp-installer] UnpackStep is failed."); break; case INSTALLER_STEP_PARSE_MANIFEST: - __pStep = new ManifestXmlStep(); + __pStep = new (std::nothrow) ManifestXmlStep(); TryReturn(__pStep, false, "[osp-installer] ManifestXmlStep is failed."); break; case INSTALLER_STEP_PARSE_SIGNATURE: - __pStep = new SignatureStep(); + __pStep = new (std::nothrow) SignatureStep(); TryReturn(__pStep, false, "[osp-installer] SignatureStep is failed."); break; case INSTALLER_STEP_UNINSTALL: - __pStep = new UninstallStep(); + __pStep = new (std::nothrow) UninstallStep(); TryReturn(__pStep, false, "[osp-installer] UninstallStep is failed."); break; case INSTALLER_STEP_LICENSE: - __pStep = new LicenseStep(); + __pStep = new (std::nothrow) LicenseStep(); TryReturn(__pStep, false, "[osp-installer] LicenseStep is failed."); break; case INSTALLER_STEP_DRM: - __pStep = new DrmStep(); + __pStep = new (std::nothrow) DrmStep(); TryReturn(__pStep, false, "[osp-installer] DrmStep is failed."); break; diff --git a/src/Installer/DirectoryInstaller.cpp b/src/Installer/DirectoryInstaller.cpp index d58b668..6c3b347 100644..100755 --- a/src/Installer/DirectoryInstaller.cpp +++ b/src/Installer/DirectoryInstaller.cpp @@ -149,7 +149,7 @@ DirectoryInstaller::RemoveInfoFiles(void) path = pPackageInfoImpl->GetAppRootPath() + DIR_INFO; - pDir = new Directory; // Allocate %Directory instance + pDir = new (std::nothrow) Directory; // Allocate %Directory instance TryCatch(pDir, res = false, "[osp-installer] pDir is null"); r = pDir->Construct(path); @@ -185,7 +185,7 @@ DirectoryInstaller::RemoveInfoFiles(void) return true; CATCH: - delete pDirEnum; + // delete pDirEnum; delete pDir; return false; } diff --git a/src/Manager/ConfigurationManager.cpp b/src/Manager/ConfigurationManager.cpp index 65bf975..95f08c1 100755 --- a/src/Manager/ConfigurationManager.cpp +++ b/src/Manager/ConfigurationManager.cpp @@ -469,17 +469,19 @@ CATCH: char* ConfigurationManager::GetCertValueN(ICertificate* pCert) const { - bool result = true; + result r = E_SUCCESS; ByteBuffer* pEncodedData = null; String base64Value; char* pEncodedValue = null; pEncodedData = pCert->GetEncodedDataN(); - TryCatch(pEncodedData, result = false, "[osp-installer] pEncodedData is null."); + TryCatch(pEncodedData, , "[osp-installer] pEncodedData is null."); + + r = StringUtil::EncodeToBase64String(*pEncodedData, base64Value); + TryCatch(!IsFailed(r), , "[osp-installer] StringUtil::EncodeToBase64String is failed."); - StringUtil::EncodeToBase64String(*pEncodedData, base64Value); pEncodedValue = _StringConverter::CopyToCharArrayN(base64Value); - TryCatch(pEncodedValue, result = false, "[osp-installer] pEncodedValue is null"); + TryCatch(pEncodedValue, , "[osp-installer] pEncodedValue is null"); CATCH: delete pEncodedData; @@ -659,7 +661,7 @@ ConfigurationManager::MergeToSystemXmlFile(const String& systemXmlPath, const St r = webXml.Construct(webXmlPath, L"r"); TryReturn(!IsFailed(r), false, "[osp-installer] webXmlPath.Construct is failed"); - std::unique_ptr<char[]> pMergedBuf(new char[mergedSize + 1]); + std::unique_ptr<char[]> pMergedBuf(new (std::nothrow) char[mergedSize + 1]); TryReturn(pMergedBuf, false, "[osp-installer] pMergedBuf is null"); memset(pMergedBuf.get(), 0, mergedSize + 1); @@ -670,7 +672,7 @@ ConfigurationManager::MergeToSystemXmlFile(const String& systemXmlPath, const St r = serviceXml.Construct(serviceXmlPath, L"r"); TryReturn(!IsFailed(r), false, "[osp-installer] serviceXmlPath.Construct is failed"); - std::unique_ptr<char[]> pServiceBuf(new char[serviceXmlFileSize + 1]); + std::unique_ptr<char[]> pServiceBuf(new (std::nothrow) char[serviceXmlFileSize + 1]); TryReturn(pServiceBuf, false, "[osp-installer] pServiceBuf is null"); memset(pServiceBuf.get(), 0, serviceXmlFileSize + 1); diff --git a/src/Manager/InstallerManager.cpp b/src/Manager/InstallerManager.cpp index 723fbac..368a505 100644..100755 --- a/src/Manager/InstallerManager.cpp +++ b/src/Manager/InstallerManager.cpp @@ -163,37 +163,37 @@ InstallerManager::CreateInstaller(InstallerType installerType) { case INSTALLER_TYPE_INSTALLER: AppLogTag(OSP_INSTALLER, "InstallerType = [Installer]"); - pInstaller = new Installer(); + pInstaller = new (std::nothrow) Installer(); break; case INSTALLER_TYPE_PACKAGE: AppLogTag(OSP_INSTALLER, "InstallerType = [PackageInstaller]"); - pInstaller = new PackageInstaller(); + pInstaller = new (std::nothrow) PackageInstaller(); break; case INSTALLER_TYPE_DIRECTORY: AppLogTag(OSP_INSTALLER, "InstallerType = [DirectoryInstaller]"); - pInstaller = new DirectoryInstaller(); + pInstaller = new (std::nothrow) DirectoryInstaller(); break; case INSTALLER_TYPE_GUEST: AppLogTag(OSP_INSTALLER, "InstallerType = [GuestInstaller]"); - pInstaller = new GuestInstaller(); + pInstaller = new (std::nothrow) GuestInstaller(); break; case INSTALLER_TYPE_PRELOADED: AppLogTag(OSP_INSTALLER, "InstallerType = [PreloadedInstaller]"); - pInstaller = new PreloadedInstaller(); + pInstaller = new (std::nothrow) PreloadedInstaller(); break; case INSTALLER_TYPE_IDE: AppLogTag(OSP_INSTALLER, "InstallerType = [IDEInstaller]"); - pInstaller = new IDEInstaller(); + pInstaller = new (std::nothrow) IDEInstaller(); break; case INSTALLER_TYPE_RESTORATION: AppLogTag(OSP_INSTALLER, "InstallerType = [RestorationInstaller]"); - pInstaller = new RestorationInstaller(); + pInstaller = new (std::nothrow) RestorationInstaller(); break; default: @@ -373,7 +373,7 @@ InstallerManager::RequestRecursiveDirectory(const Tizen::Base::String& path, int int successCount = 0; int failureCount = 0; - pDir = new Directory; // Allocate %Directory instance + pDir = new (std::nothrow) Directory; // Allocate %Directory instance TryCatch(pDir, res = false, "[osp-installer] pDir is null"); r = pDir->Construct(path); diff --git a/src/Manager/SignatureManager.cpp b/src/Manager/SignatureManager.cpp index 2a43186..2d37017 100644..100755 --- a/src/Manager/SignatureManager.cpp +++ b/src/Manager/SignatureManager.cpp @@ -62,7 +62,7 @@ SignatureManager::SetSignature() char* pSignaturePath = _StringConverter::CopyToCharArrayN(__pContext->GetSignatureXmlPath()); char* pAuthorSignaturePath = _StringConverter::CopyToCharArrayN(__pContext->GetAuthorSignatureXmlPath()); - __pDistributorSignature = new SignatureHandler; + __pDistributorSignature = new (std::nothrow) SignatureHandler; TryCatch(__pDistributorSignature, ret = false, "[osp-installer] __pDistributorSignature is null"); ret = __pDistributorSignature->Construct(__pContext); @@ -71,7 +71,7 @@ SignatureManager::SetSignature() ret = __pDistributorSignature->Parse(pSignaturePath); TryCatch(ret == true, ret = false, "[osp-installer] __pDistributorSignature->Parse is failed."); - __pAuthorSignature = new SignatureHandler; + __pAuthorSignature = new (std::nothrow) SignatureHandler; TryCatch(__pAuthorSignature, ret = false, "[osp-installer] __pAuthorSignature is null"); ret = __pAuthorSignature->Construct(__pContext); @@ -100,7 +100,7 @@ SignatureManager::AddCert() { AppLogTag(OSP_INSTALLER, "AddCertificate - AuthorCertChain"); - __pAuthorCertPath = new X509CertificatePath(); + __pAuthorCertPath = new (std::nothrow) X509CertificatePath(); TryCatch(__pAuthorCertPath, ret = false, "[osp-installer] __pAuthorCertPath is null."); ret = AddCertificate(__pAuthorCertPath, pAuthorCertChain); @@ -114,7 +114,7 @@ SignatureManager::AddCert() { AppLogTag(OSP_INSTALLER, "AddCertificate - DistributorCert"); - __pDistributorCertPath = new X509CertificatePath(); + __pDistributorCertPath = new (std::nothrow) X509CertificatePath(); TryCatch(__pDistributorCertPath, ret = false, "[osp-installer] __pDistributorCertPath is null."); ret = AddCertificate(__pDistributorCertPath, pDistributorCertChain); @@ -210,7 +210,7 @@ SignatureManager::AddCertificate(X509CertificatePath* pCertPath, IList* pCertCha { AppLogTag(OSP_INSTALLER, "[cert][%d]", i); - pCertificate = new X509Certificate; + pCertificate = new (std::nothrow) X509Certificate; TryCatch(pCertificate, ret = false, "[osp-installer] pCertificate is null."); r = pCertificate->Construct(*pByteBuffer); diff --git a/src/Step/SignatureStep.cpp b/src/Step/SignatureStep.cpp index 33aa68a..768acd1 100644..100755 --- a/src/Step/SignatureStep.cpp +++ b/src/Step/SignatureStep.cpp @@ -120,7 +120,7 @@ SignatureStep::OnStateSignerCert(void) InstallerError error = INSTALLER_ERROR_NONE; bool ret = true; - __pSignatureManager = new SignatureManager(); + __pSignatureManager = new (std::nothrow) SignatureManager(); TryCatch(__pSignatureManager, error = INSTALLER_ERROR_MEMORY, "[osp-installer] __pSignatureManager is null."); ret = __pSignatureManager->Construct(__pContext); diff --git a/src/Step/UnpackStep.cpp b/src/Step/UnpackStep.cpp index b42e1a0..0711d39 100644..100755 --- a/src/Step/UnpackStep.cpp +++ b/src/Step/UnpackStep.cpp @@ -270,7 +270,7 @@ UnpackStep::GetUncompressedInfo(const FileUnzipper& unzipper) while((r = entryName.IndexOf(L'/', startIndex, indexOf)) == E_SUCCESS) { - String* pCurDirectory = new String; + String* pCurDirectory = new (std::nothrow) String; TryReturn(pCurDirectory, false, "[osp-installer] pCurDirectory is null."); entryName.SubString(0, indexOf, *pCurDirectory); diff --git a/src/Util/InstallerUtil.cpp b/src/Util/InstallerUtil.cpp index b668d30..4caa238 100755 --- a/src/Util/InstallerUtil.cpp +++ b/src/Util/InstallerUtil.cpp @@ -92,7 +92,7 @@ InstallerUtil::Remove(const Tizen::Base::String& filePath) bool InstallerUtil::Copy(const String& srcFilePath, const String& destFilePath) { - const int bufSize = 4096; + int bufSize = 4096; int readBytes = 0; result r = E_SUCCESS; @@ -101,7 +101,7 @@ InstallerUtil::Copy(const String& srcFilePath, const String& destFilePath) File srcFile; File destFile; - std::unique_ptr<char[]> pBuf(new char[bufSize]); + std::unique_ptr<char[]> pBuf(new (std::nothrow) char[bufSize]); TryReturn(pBuf, false, "[osp-installer] pBuf is null"); r = srcFile.Construct(srcFilePath, L"r"); @@ -131,7 +131,7 @@ InstallerUtil::CopyDirectory(const String& srcFilePath, const String& destFilePa AppLogTag(OSP_INSTALLER, "+ CopyDirectory(): src=[%ls], dest=[%ls]", srcFilePath.GetPointer(), destFilePath.GetPointer()); - std::unique_ptr<Directory> pDir(new Directory); + std::unique_ptr<Directory> pDir(new (std::nothrow) Directory); TryReturn(pDir, false, "[osp-installer] pDir is null."); r = pDir->Construct(srcFilePath); @@ -287,7 +287,7 @@ InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode) return true; } - std::unique_ptr<Directory> pDir(new Directory); + std::unique_ptr<Directory> pDir(new (std::nothrow) Directory); TryReturn(pDir, false, "[osp-installer] pDir is null."); r = pDir->Construct(filePath); diff --git a/src/XmlHandler/ManifestGenerator.cpp b/src/XmlHandler/ManifestGenerator.cpp index 1c7250c..7c5c3e2 100755 --- a/src/XmlHandler/ManifestGenerator.cpp +++ b/src/XmlHandler/ManifestGenerator.cpp @@ -55,7 +55,7 @@ ManifestGenerator::Construct(InstallationContext* pContext) __pContext = pContext; __pPackageInfoImpl = pContext->GetPackageInfoImpl(); - __pWriter = new XmlWriter; + __pWriter = new (std::nothrow) XmlWriter; TryReturn(__pWriter, false, "[osp-installer] __pWriter is null."); return true; @@ -225,8 +225,6 @@ ManifestGenerator::WriteLanguageValue(IMap* pList, const String& element) const __pWriter->WriteAttribute("xml:lang", launguage); __pWriter->WriteString(*pValue); __pWriter->EndElement(); - - AppLogTag(OSP_INSTALLER, "Lang [%ls]->[%ls], value=[%ls]", pLanguage->GetPointer(), launguage.GetPointer(), pValue->GetPointer()); } delete pMapEnum; diff --git a/src/XmlHandler/ManifestHandler.cpp b/src/XmlHandler/ManifestHandler.cpp index 521d6ae..3c742f4 100755 --- a/src/XmlHandler/ManifestHandler.cpp +++ b/src/XmlHandler/ManifestHandler.cpp @@ -366,7 +366,7 @@ ManifestHandler::OnCharacters(const char *pCharacters) bool ManifestHandler::OnPrivilegesStartElement(void) { - __pPrivilegeList = new ArrayList; + __pPrivilegeList = new (std::nothrow) ArrayList; TryReturn(__pPrivilegeList, false, "[osp-installer] __pPrivilegeList is null"); AppLogTag(OSP_INSTALLER, "<Privileges>"); @@ -379,7 +379,7 @@ ManifestHandler::OnUiAppStartElement(void) { XmlAttribute *pAttr = null; - __pPackageAppInfoImpl = new _PackageAppInfoImpl; + __pPackageAppInfoImpl = new (std::nothrow) _PackageAppInfoImpl; TryReturn(__pPackageAppInfoImpl, false, "[osp-installer] __pPackageAppInfoImpl is null"); __pAppData = new (std::nothrow) AppData; @@ -400,7 +400,7 @@ ManifestHandler::OnServiceAppStartElement(void) { XmlAttribute *pAttr = null; - __pPackageAppInfoImpl = new _PackageAppInfoImpl; + __pPackageAppInfoImpl = new (std::nothrow) _PackageAppInfoImpl; TryReturn(__pPackageAppInfoImpl, false, "[osp-installer] __pPackageAppInfoImpl is null"); __pAppData = new (std::nothrow) AppData; @@ -468,7 +468,7 @@ ManifestHandler::OnUiScalabilityStartElement(void) pCoordinateSystem = pAttr->Find("CoordinateSystem"); if (pCoordinateSystem) { - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; + _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl; TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); pAppFeatureInfo->SetName("CoordinateSystem"); @@ -482,7 +482,7 @@ ManifestHandler::OnUiScalabilityStartElement(void) pBaseScreenSize = pAttr->Find("BaseScreenSize"); if (pBaseScreenSize) { - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; + _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl; TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); pAppFeatureInfo->SetName("BaseScreenSize"); @@ -496,7 +496,7 @@ ManifestHandler::OnUiScalabilityStartElement(void) pLogicalCoordinate = pAttr->Find("LogicalCoordinate"); if (pLogicalCoordinate) { - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; + _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl; TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); pAppFeatureInfo->SetName("LogicalCoordinate"); @@ -525,7 +525,7 @@ ManifestHandler::OnUiThemeStartElement(void) pSystemTheme = pAttr->Find("SystemTheme"); if (pSystemTheme) { - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; + _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl; TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); pAppFeatureInfo->SetName("SystemTheme"); @@ -539,7 +539,7 @@ ManifestHandler::OnUiThemeStartElement(void) pUserDefinedTheme = pAttr->Find("UserDefinedTheme"); if (pUserDefinedTheme) { - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; + _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl; TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); pAppFeatureInfo->SetName("UserDefinedTheme"); @@ -569,7 +569,7 @@ ManifestHandler::OnAppControlStartElement(void) pAttrValue2 = pAttr->Find("Category"); TryReturn(pAttrValue2, true, "[osp-installer] pAttrValue2 is null"); - __pAppControlInfoImpl = new _AppControlInfoImpl; + __pAppControlInfoImpl = new (std::nothrow) _AppControlInfoImpl; TryReturn(__pAppControlInfoImpl, false, "[osp-installer] __pAppControlInfoImpl is null"); __pAppControlInfoImpl->SetProviderId(pAttrValue1); @@ -592,7 +592,7 @@ ManifestHandler::OnCapabilityStartElement(void) pAttrValue = pAttr->Find("OperationId"); TryReturn(pAttrValue, true, "[osp-installer] pAttrValue1 is null"); - __pAppControlCapabilityInfoImpl = new _AppControlCapabilityInfoImpl; + __pAppControlCapabilityInfoImpl = new (std::nothrow) _AppControlCapabilityInfoImpl; TryReturn(__pAppControlCapabilityInfoImpl, false, "[osp-installer] __pAppControlCapabilityInfoImpl is null"); __pAppControlCapabilityInfoImpl->SetOperationId(pAttrValue); @@ -615,18 +615,18 @@ ManifestHandler::OnResolutionStartElement(void) pAttrValue1 = pAttr->Find("MimeType"); pAttrValue2 = pAttr->Find("UriScheme"); - __pAppControlResolutionInfoImpl = new _AppControlResolutionInfoImpl; + __pAppControlResolutionInfoImpl = new (std::nothrow) _AppControlResolutionInfoImpl; TryReturn(__pAppControlResolutionInfoImpl, false, "[osp-installer] __pAppControlResolutionInfoImpl is null"); if (pAttrValue1) { - String* pMimeType = new String(pAttrValue1); + String* pMimeType = new (std::nothrow) String(pAttrValue1); __pAppControlResolutionInfoImpl->SetMimeType(pMimeType); } if (pAttrValue2) { - String* pUriScheme = new String(pAttrValue2); + String* pUriScheme = new (std::nothrow) String(pAttrValue2); __pAppControlResolutionInfoImpl->SetUriScheme(pUriScheme); } @@ -669,7 +669,7 @@ ManifestHandler::OnDataControlStartElement(void) pProviderId = pAttr->Find("ProviderId"); TryReturn(pProviderId, true, "[osp-installer] pProviderId is null"); - __pDataControlInfoImpl = new _DataControlInfoImpl; + __pDataControlInfoImpl = new (std::nothrow) _DataControlInfoImpl; TryReturn(__pDataControlInfoImpl, false, "[osp-installer] __pDataControlInfoImpl is null"); __pDataControlInfoImpl->SetProviderId(pProviderId); @@ -682,7 +682,7 @@ ManifestHandler::OnDataControlStartElement(void) bool ManifestHandler::OnContentsStartElement(void) { - __pContentInfoList = new ArrayList; + __pContentInfoList = new (std::nothrow) ArrayList; TryReturn(__pContentInfoList, false, "[osp-installer] __pContentInfoList is null"); AppLogTag(OSP_INSTALLER, "<Contents>"); @@ -698,7 +698,7 @@ ManifestHandler::OnContentStartElement(void) XmlAttribute *pAttr = null; char *pDefault = null; - __pContentInfo = new ContentInfo; + __pContentInfo = new (std::nothrow) ContentInfo; TryReturn(__pContentInfo, false, "[osp-installer] __pLiveboxInfo is null"); pAttr = GetAttribute(); @@ -733,7 +733,7 @@ ManifestHandler::OnContentStartElement(void) bool ManifestHandler::OnLiveBoxesStartElement(void) { - __pLiveBoxList = new ArrayList; + __pLiveBoxList = new (std::nothrow) ArrayList; TryReturn(__pLiveBoxList, false, "[osp-installer] __pLiveBoxList is null"); AppLogTag(OSP_INSTALLER, "<LiveBoxes>"); @@ -751,7 +751,7 @@ ManifestHandler::OnLiveBoxStartElement(void) char *pPopupEnabled = null; char *pName = null; - __pLiveboxInfo = new LiveboxInfo; + __pLiveboxInfo = new (std::nothrow) LiveboxInfo; TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null"); pAttr = GetAttribute(); @@ -1085,7 +1085,7 @@ ManifestHandler::OnApiVersionValue(const char *pCharacters) bool ManifestHandler::OnPrivilegeValue(const char *pCharacters) { - __pPrivilegeList->Add(*new String(pCharacters)); + __pPrivilegeList->Add(*new (std::nothrow) String(pCharacters)); AppLogTag(OSP_INSTALLER, "<Privilege>%s</Privilege>", pCharacters); return true; @@ -1194,17 +1194,17 @@ ManifestHandler::OnNameValue(const char *pCharacters) { TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null"); - String* pValue = new String; + String* pValue = new (std::nothrow) String; StringUtil::Utf8ToString(pCharacters, *pValue); - __pLiveboxInfo->AddName(*(new String(pAttrValue)), *pValue); + __pLiveboxInfo->AddName(*(new (std::nothrow) String(pAttrValue)), *pValue); } else if (FindElement("Content") == true) { TryReturn(__pContentInfo, false, "[osp-installer] __pContentInfo is null"); - String* pValue = new String; + String* pValue = new (std::nothrow) String; StringUtil::Utf8ToString(pCharacters, *pValue); - __pContentInfo->AddName(*(new String(pAttrValue)), *pValue); + __pContentInfo->AddName(*(new (std::nothrow) String(pAttrValue)), *pValue); } else { @@ -1218,9 +1218,9 @@ ManifestHandler::OnNameValue(const char *pCharacters) if (__pPackageAppInfoImpl) { - String* pValue = new String; + String* pValue = new (std::nothrow) String; StringUtil::Utf8ToString(pCharacters, *pValue); - __pPackageAppInfoImpl->AddName(*(new String(pAttrValue)), *pValue); + __pPackageAppInfoImpl->AddName(*(new (std::nothrow) String(pAttrValue)), *pValue); } } @@ -1264,7 +1264,7 @@ ManifestHandler::OnDataControlTypeValue(const char *pCharacters) pAccessValue = pAttr->Find("Access"); TryReturn(pAccessValue, true, "[osp-installer] pAccessValue is null"); - __pDataControlTypeImpl = new _DataControlTypeImpl; + __pDataControlTypeImpl = new (std::nothrow) _DataControlTypeImpl; TryReturn(__pDataControlTypeImpl, false, "[osp-installer] __pDataControlTypeImpl is null"); __pDataControlTypeImpl->SetType(pCharacters); @@ -1287,7 +1287,7 @@ ManifestHandler::OnConditionValue(const char *pCharacters) pName = pAttr->Find("Name"); TryReturn(pName, true, "[osp-installer] pName is null"); - __pLaunchConditionImpl = new _LaunchConditionInfoImpl; + __pLaunchConditionImpl = new (std::nothrow) _LaunchConditionInfoImpl; TryReturn(__pLaunchConditionImpl, false, "[osp-installer] __pLaunchConditionImpl is null"); __pLaunchConditionImpl->SetName(pName); @@ -1310,7 +1310,7 @@ ManifestHandler::OnNotificationValue(const char *pCharacters) pName = pAttr->Find("Name"); TryReturn(pName, true, "[osp-installer] pName is null"); - __pNotificationImpl = new _NotificationInfoImpl; + __pNotificationImpl = new (std::nothrow) _NotificationInfoImpl; TryReturn(__pNotificationImpl, false, "[osp-installer] __pNotificationImpl is null"); __pNotificationImpl->SetName(pName); @@ -1326,7 +1326,7 @@ ManifestHandler::OnSizeValue(const char *pCharacters) { TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null"); - __pLiveboxInfo->AddSize(*(new String(pCharacters))); + __pLiveboxInfo->AddSize(*(new (std::nothrow) String(pCharacters))); AppLogTag(OSP_INSTALLER, "<Size>%s</Size>", pCharacters); return true; @@ -1353,7 +1353,7 @@ ManifestHandler::OnCategoryValue(const char *pCharacters) { TryReturn(__pAppData, false, "[osp-installer] __pAppData is null"); - __pAppData->__pCategoryList->Add(new String(pCharacters)); + __pAppData->__pCategoryList->Add(new (std::nothrow) String(pCharacters)); return true; } @@ -1407,7 +1407,7 @@ ManifestHandler::FindElement(const char *pName) bool ManifestHandler::AddAppFeature(const Tizen::Base::String& name, const Tizen::Base::String& value) { - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; + _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl; TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); pAppFeatureInfo->SetName(name); @@ -1478,15 +1478,15 @@ ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp) if (strcasecmp(pCategory, "home-screen") == 0) { - __pAppData->__pCategoryList->Add(new String("http://tizen.org/category/homescreen")); + __pAppData->__pCategoryList->Add(new (std::nothrow) String("http://tizen.org/category/homescreen")); } else if (strcasecmp(pCategory, "lock-screen") == 0) { - __pAppData->__pCategoryList->Add(new String("http://tizen.org/category/lockscreen")); + __pAppData->__pCategoryList->Add(new (std::nothrow) String("http://tizen.org/category/lockscreen")); } else if (strcasecmp(pCategory, "Ime") == 0) { - __pAppData->__pCategoryList->Add(new String("http://tizen.org/category/ime")); + __pAppData->__pCategoryList->Add(new (std::nothrow) String("http://tizen.org/category/ime")); } CategoryType categoryType = InstallerUtil::GetCategoryType(pCategory); diff --git a/src/XmlHandler/PrivilegeHandler.cpp b/src/XmlHandler/PrivilegeHandler.cpp index 4437dbe..092c7a7 100644..100755 --- a/src/XmlHandler/PrivilegeHandler.cpp +++ b/src/XmlHandler/PrivilegeHandler.cpp @@ -205,11 +205,7 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList) CATCH: delete pEnum; - - if (pResult) - { - free(pResult); - } + free(pResult); SysLog(NID_SEC, "Exit."); return null; @@ -317,11 +313,7 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList, int visibilityLevel CATCH: delete pEnum; - - if (pResult) - { - free(pResult); - } + free(pResult); SysLog(NID_SEC, "Exit."); return r; diff --git a/src/XmlHandler/SignatureHandler.cpp b/src/XmlHandler/SignatureHandler.cpp index 9aa8434..17cc465 100644..100755 --- a/src/XmlHandler/SignatureHandler.cpp +++ b/src/XmlHandler/SignatureHandler.cpp @@ -163,11 +163,11 @@ SignatureHandler::OnCertificateValue(const char *pCharacters) { if (__pAuthorCertChain == null) { - __pAuthorCertChain = new ArrayList; + __pAuthorCertChain = new (std::nothrow) ArrayList; TryCatch(__pAuthorCertChain, res = false, "[osp-installer] __pAuthorCertChain is null"); } - pByteBuffer = new ByteBuffer; + pByteBuffer = new (std::nothrow) ByteBuffer; TryCatch(pByteBuffer, res = false, "[osp-installer] pByteBuffer is null"); int length = strlen(pCharacters); @@ -185,11 +185,11 @@ SignatureHandler::OnCertificateValue(const char *pCharacters) { if (__pDistributorCertChain == null) { - __pDistributorCertChain = new ArrayList; + __pDistributorCertChain = new (std::nothrow) ArrayList; TryCatch(__pDistributorCertChain, res = false, "[osp-installer] __pDistributorCertChain is null"); } - pByteBuffer = new ByteBuffer; + pByteBuffer = new (std::nothrow) ByteBuffer; TryCatch(pByteBuffer, res = false, "[osp-installer] pByteBuffer is null"); int length = strlen(pCharacters); diff --git a/src/XmlHandler/XmlAttribute.cpp b/src/XmlHandler/XmlAttribute.cpp index 3b4985d..5b20585 100755 --- a/src/XmlHandler/XmlAttribute.cpp +++ b/src/XmlHandler/XmlAttribute.cpp @@ -49,11 +49,11 @@ XmlAttribute::Construct(const char *pName, const char *pValue) return true; } - __pName = new char[strlen(pName)+1]; + __pName = new (std::nothrow) char[strlen(pName)+1]; TryReturn(__pName, false, "[osp-installer] __pName is null"); strcpy(__pName, pName); - __pValue = new char[strlen(pValue)+1]; + __pValue = new (std::nothrow) char[strlen(pValue)+1]; TryReturn(__pValue, false, "[osp-installer] __pValue is null"); strcpy(__pValue, pValue); @@ -105,7 +105,7 @@ XmlAttribute::Add(const char *pName, const char *pValue) } else { - __pNext = new XmlAttribute(); + __pNext = new (std::nothrow) XmlAttribute(); TryReturn(__pNext, false, "[osp-installer] __pNext is null"); __pNext->Construct(pName, pValue); diff --git a/src/XmlHandler/XmlHandler.cpp b/src/XmlHandler/XmlHandler.cpp index 5654c4c..b958d7d 100644..100755 --- a/src/XmlHandler/XmlHandler.cpp +++ b/src/XmlHandler/XmlHandler.cpp @@ -363,11 +363,11 @@ XmlHandler::SetElementName(const char *pElementName) __pElementName = null; } - __pElementName = new char[strlen(pElementName)+1]; + __pElementName = new (std::nothrow) char[strlen(pElementName)+1]; TryReturn(__pElementName, false, "[osp-installer] __pElementName is null"); strcpy(__pElementName, pElementName); - __elementStack.Push(*new String(pElementName)); + __elementStack.Push(*new (std::nothrow) String(pElementName)); return true; } diff --git a/src/XmlHandler/XmlWriter.cpp b/src/XmlHandler/XmlWriter.cpp index 59866a1..4fe216f 100755 --- a/src/XmlHandler/XmlWriter.cpp +++ b/src/XmlHandler/XmlWriter.cpp @@ -46,8 +46,13 @@ XmlWriter::XmlWriter(void) XmlWriter::~XmlWriter(void) { result r = E_SUCCESS; + int err = 0; - xmlTextWriterEndDocument(__pXmlWriter); + err = xmlTextWriterEndDocument(__pXmlWriter); + if (err != 0) + { + AppLogTag(OSP_INSTALLER, "xmlTextWriterEndDocument() is failed"); + } File file; r = file.Construct(__xmlFilePath, "w"); @@ -123,15 +128,21 @@ bool XmlWriter::StartElement(const Tizen::Base::String& name) { ByteBuffer* pNameBuf = null; + int err = 0; + bool res = true; pNameBuf = StringUtil::StringToUtf8N(name); if (pNameBuf) { - xmlTextWriterStartElement(__pXmlWriter, (xmlChar *)pNameBuf->GetPointer()); + err = xmlTextWriterStartElement(__pXmlWriter, (xmlChar *)pNameBuf->GetPointer()); + if (err != 0) + { + res = false; + } } delete pNameBuf; - return true; + return res; } bool @@ -139,33 +150,45 @@ XmlWriter::WriteAttribute(const Tizen::Base::String& name, const Tizen::Base::St { ByteBuffer* pNameBuf = null; ByteBuffer* pContentBuf = null; + int err = 0; + bool res = true; pNameBuf = StringUtil::StringToUtf8N(name); pContentBuf = StringUtil::StringToUtf8N(content); if (pNameBuf && pContentBuf) { - xmlTextWriterWriteAttribute(__pXmlWriter, (xmlChar *)pNameBuf->GetPointer(), (xmlChar *)pContentBuf->GetPointer()); + err = xmlTextWriterWriteAttribute(__pXmlWriter, (xmlChar *)pNameBuf->GetPointer(), (xmlChar *)pContentBuf->GetPointer()); + if (err != 0) + { + res = false; + } } delete pNameBuf; delete pContentBuf; - return true; + return res; } bool XmlWriter::WriteString(const Tizen::Base::String& content) { ByteBuffer* pContentBuf = null; + int err = 0; + bool res = true; pContentBuf = StringUtil::StringToUtf8N(content); if (pContentBuf) { - xmlTextWriterWriteString(__pXmlWriter, (xmlChar *)pContentBuf->GetPointer()); + err = xmlTextWriterWriteString(__pXmlWriter, (xmlChar *)pContentBuf->GetPointer()); + if (err != 0) + { + res = false; + } } delete pContentBuf; - return true; + return res; } bool |