mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-19 12:13:04 -04:00
@@ -142,7 +142,10 @@ int32_t BundleDaemon::RegisterCallbackInvoke(IpcIo *req)
|
||||
if (!(ReadRemoteObject(req, &svcIdentity))) {
|
||||
return EC_INVALID;
|
||||
}
|
||||
BundleDaemon::GetInstance().bundleMsClient_ = new BundleMsClient(svcIdentity);
|
||||
BundleDaemon::GetInstance().bundleMsClient_ = new (std::nothrow) BundleMsClient(svcIdentity);
|
||||
if (BundleDaemon::GetInstance().bundleMsClient_ == nullptr) {
|
||||
return EC_BADPTR;
|
||||
}
|
||||
return BundleDaemon::GetInstance().bundleMsClient_->SendReply(EC_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ extern "C" {
|
||||
namespace OHOS {
|
||||
ManagerService::ManagerService()
|
||||
{
|
||||
installer_ = new BundleInstaller(INSTALL_PATH, DATA_PATH);
|
||||
installer_ = new (std::nothrow) BundleInstaller(INSTALL_PATH, DATA_PATH);
|
||||
bundleMap_ = BundleMap::GetInstance();
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ void ManagerService::ServiceMsgProcess(Request* request)
|
||||
}
|
||||
|
||||
if (installer_ == nullptr) {
|
||||
installer_ = new BundleInstaller(INSTALL_PATH, DATA_PATH);
|
||||
installer_ = new (std::nothrow) BundleInstaller(INSTALL_PATH, DATA_PATH);
|
||||
}
|
||||
|
||||
switch (request->msgId) {
|
||||
|
||||
@@ -41,7 +41,7 @@ BundleMap::BundleMap()
|
||||
#else
|
||||
g_bundleListMutex = osMutexNew(reinterpret_cast<osMutexAttr_t *>(NULL));
|
||||
#endif
|
||||
bundleInfos_ = new List<BundleInfo *>();
|
||||
bundleInfos_ = new (std::nothrow) List<BundleInfo *>();
|
||||
}
|
||||
|
||||
BundleMap::~BundleMap()
|
||||
@@ -83,7 +83,7 @@ bool BundleMap::Update(BundleInfo *bundleInfo)
|
||||
#else
|
||||
MutexAcquire(&g_bundleListMutex, BUNDLELIST_MUTEX_TIMEOUT);
|
||||
#endif
|
||||
auto newNode = new Node<BundleInfo *>(bundleInfo);
|
||||
auto newNode = new (std::nothrow) Node<BundleInfo *>(bundleInfo);
|
||||
if (newNode == nullptr) {
|
||||
MutexRelease(&g_bundleListMutex);
|
||||
return false;
|
||||
|
||||
@@ -47,8 +47,8 @@ const uint8_t BMS_INSTALLATION_COMPLETED = 100;
|
||||
|
||||
GtManagerService::GtManagerService()
|
||||
{
|
||||
installer_ = new GtBundleInstaller();
|
||||
bundleResList_ = new List<BundleRes *>();
|
||||
installer_ = new (std::nothrow) GtBundleInstaller();
|
||||
bundleResList_ = new (std::nothrow) List<BundleRes *>();
|
||||
bundleMap_ = BundleMap::GetInstance();
|
||||
bundleInstallMsg_ = nullptr;
|
||||
jsEngineVer_ = nullptr;
|
||||
@@ -56,7 +56,7 @@ GtManagerService::GtManagerService()
|
||||
preAppList_ = nullptr;
|
||||
updateFlag_ = false;
|
||||
oldVersionCode_ = -1;
|
||||
listenList_ = new List<InstallerCallback>();
|
||||
listenList_ = new (std::nothrow) List<InstallerCallback>();
|
||||
}
|
||||
|
||||
GtManagerService::~GtManagerService()
|
||||
@@ -73,7 +73,7 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP
|
||||
InstallerCallback installerCallback)
|
||||
{
|
||||
if (installer_ == nullptr) {
|
||||
installer_ = new GtBundleInstaller();
|
||||
installer_ = new (std::nothrow) GtBundleInstaller();
|
||||
}
|
||||
if (hapPath == nullptr) {
|
||||
return false;
|
||||
@@ -170,7 +170,7 @@ bool GtManagerService::Uninstall(const char *bundleName, const InstallParam *ins
|
||||
InstallerCallback installerCallback)
|
||||
{
|
||||
if (installer_ == nullptr) {
|
||||
installer_ = new GtBundleInstaller();
|
||||
installer_ = new (std::nothrow) GtBundleInstaller();
|
||||
}
|
||||
if (bundleName == nullptr) {
|
||||
HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] Parsed bundleName to be uninstalled is null");
|
||||
@@ -298,7 +298,7 @@ uint8_t GtManagerService::QueryAbilityInfos(const Want *want, AbilityInfo **abil
|
||||
return 0;
|
||||
}
|
||||
int32_t abilityInfoLen = 0;
|
||||
List<BundleInfo *> *bundleInfos_ = new List<BundleInfo *>();
|
||||
List<BundleInfo *> *bundleInfos_ = new (std::nothrow) List<BundleInfo *>();
|
||||
bundleMap_->GetBundleInfosInner(*bundleInfos_);
|
||||
|
||||
for (auto node = bundleInfos_->Begin(); node != bundleInfos_->End(); node = node->next_) {
|
||||
|
||||
@@ -437,13 +437,13 @@ bool ZipFile::InitZStream(z_stream &zstream) const
|
||||
return false;
|
||||
}
|
||||
|
||||
BytePtr bufOut = new Byte[UNZIP_BUF_OUT_LEN];
|
||||
BytePtr bufOut = new (std::nothrow) Byte[UNZIP_BUF_OUT_LEN];
|
||||
if (bufOut == nullptr) {
|
||||
HILOG_ERROR(HILOG_MODULE_APP, "unzip inflated new out buffer failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
BytePtr bufIn = new Byte[UNZIP_BUF_IN_LEN];
|
||||
BytePtr bufIn = new (std::nothrow) Byte[UNZIP_BUF_IN_LEN];
|
||||
if (bufIn == nullptr) {
|
||||
HILOG_ERROR(HILOG_MODULE_APP, "unzip inflated new in buffer failed");
|
||||
delete[] bufOut;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#ifndef OHOS_UTILS_LIST_H
|
||||
#define OHOS_UTILS_LIST_H
|
||||
|
||||
#include <new>
|
||||
|
||||
namespace OHOS {
|
||||
template<class T>
|
||||
struct Node {
|
||||
@@ -32,7 +34,7 @@ class List {
|
||||
public:
|
||||
List() : count_(0)
|
||||
{
|
||||
head_ = new Node<T>();
|
||||
head_ = new (std::nothrow) Node<T>();
|
||||
head_->next_ = head_;
|
||||
head_->prev_ = head_;
|
||||
}
|
||||
@@ -55,7 +57,7 @@ public:
|
||||
|
||||
void PushFront(T value)
|
||||
{
|
||||
auto node = new Node<T>(value);
|
||||
auto node = new (std::nothrow) Node<T>(value);
|
||||
if (node == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -91,7 +93,7 @@ public:
|
||||
|
||||
void PushBack(T value)
|
||||
{
|
||||
auto node = new Node<T>(value);
|
||||
auto node = new (std::nothrow) Node<T>(value);
|
||||
|
||||
node->next_ = head_;
|
||||
node->prev_ = head_->prev_;
|
||||
|
||||
Reference in New Issue
Block a user