提交 5406357a 编写于 作者: S shufewhx

fix processskeleton double free problem in fuzz test

Signed-off-by: Nshufewhx <wanghaoxu1@huawei.com>
上级 8a4e3248
...@@ -27,7 +27,7 @@ namespace OHOS { ...@@ -27,7 +27,7 @@ namespace OHOS {
class ProcessSkeleton : public virtual RefBase { class ProcessSkeleton : public virtual RefBase {
public: public:
static sptr<ProcessSkeleton> GetInstance(); static ProcessSkeleton* GetInstance();
sptr<IRemoteObject> GetRegistryObject(); sptr<IRemoteObject> GetRegistryObject();
void SetRegistryObject(sptr<IRemoteObject> &object); void SetRegistryObject(sptr<IRemoteObject> &object);
void SetSamgrFlag(bool flag); void SetSamgrFlag(bool flag);
...@@ -43,7 +43,7 @@ private: ...@@ -43,7 +43,7 @@ private:
ProcessSkeleton() = default; ProcessSkeleton() = default;
~ProcessSkeleton(); ~ProcessSkeleton();
static sptr<ProcessSkeleton> instance_; static ProcessSkeleton* instance_;
static std::mutex mutex_; static std::mutex mutex_;
std::shared_mutex objMutex_; std::shared_mutex objMutex_;
sptr<IRemoteObject> registryObject_ = nullptr; sptr<IRemoteObject> registryObject_ = nullptr;
......
...@@ -523,7 +523,7 @@ int IPCObjectProxy::GetProtoInfo() ...@@ -523,7 +523,7 @@ int IPCObjectProxy::GetProtoInfo()
MessageParcel data, reply; MessageParcel data, reply;
MessageOption option; MessageOption option;
int err = SendRequestInner(true, GET_PROTO_INFO, data, reply, option); int err = SendRequestInner(true, GET_PROTO_INFO, data, reply, option);
if (err != ERR_NONE) { if (err != ERR_NONE && err != -EBADMSG) {
ZLOGW(LABEL, "GET_PROTO_INFO transact return error = %{public}d", err); ZLOGW(LABEL, "GET_PROTO_INFO transact return error = %{public}d", err);
return IRemoteObject::IF_PROT_ERROR; return IRemoteObject::IF_PROT_ERROR;
} }
......
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
namespace OHOS { namespace OHOS {
static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_ID_IPC, "ProcessSkeleton" }; static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_ID_IPC, "ProcessSkeleton" };
sptr<ProcessSkeleton> ProcessSkeleton::instance_ = nullptr; ProcessSkeleton* ProcessSkeleton::instance_ = nullptr;
std::mutex ProcessSkeleton::mutex_; std::mutex ProcessSkeleton::mutex_;
sptr<ProcessSkeleton> ProcessSkeleton::GetInstance() ProcessSkeleton* ProcessSkeleton::GetInstance()
{ {
if (instance_ == nullptr) { if (instance_ == nullptr) {
std::lock_guard<std::mutex> lockGuard(mutex_); std::lock_guard<std::mutex> lockGuard(mutex_);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册