Skip to content

Commit

Permalink
[MOS] Fix mos leak and out of scope issue
Browse files Browse the repository at this point in the history
Fix potential leak and out of scope issues
  • Loading branch information
Xiaohua-Work authored and intel-mediadev committed Aug 5, 2023
1 parent 00d560b commit d88fdda
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions media_common/agnostic/common/os/mos_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,13 @@ struct _MOS_GPUCTX_CREATOPTIONS
SSEUValue(0),
isRealTimePriority(0){}

_MOS_GPUCTX_CREATOPTIONS(_MOS_GPUCTX_CREATOPTIONS* createOption) : CmdBufferNumScale(createOption->CmdBufferNumScale),
RAMode(createOption->RAMode),
ProtectMode(createOption->ProtectMode),
gpuNode(createOption->gpuNode),
SSEUValue(createOption->SSEUValue),
isRealTimePriority(createOption->isRealTimePriority) {}

virtual ~_MOS_GPUCTX_CREATOPTIONS(){}
};

Expand Down Expand Up @@ -2164,6 +2171,34 @@ struct _MOS_GPUCTX_CREATOPTIONS_ENHANCED : public _MOS_GPUCTX_CREATOPTIONS
}
#endif
}

_MOS_GPUCTX_CREATOPTIONS_ENHANCED(_MOS_GPUCTX_CREATOPTIONS* createOption)
: _MOS_GPUCTX_CREATOPTIONS(createOption)
{
if (typeid(*createOption) == typeid(_MOS_GPUCTX_CREATOPTIONS_ENHANCED))
{
Flags = ((MOS_GPUCTX_CREATOPTIONS_ENHANCED *)createOption)->Flags;
LRCACount = ((MOS_GPUCTX_CREATOPTIONS_ENHANCED *)createOption)->LRCACount;
#if (_DEBUG || _RELEASE_INTERNAL)
for (auto i = 0; i < MOS_MAX_ENGINE_INSTANCE_PER_CLASS; i++)
{
EngineInstance[i] = ((MOS_GPUCTX_CREATOPTIONS_ENHANCED *)createOption)->EngineInstance[i];
}
#endif
}
else
{
Flags = 0;
LRCACount = 0;
#if (_DEBUG || _RELEASE_INTERNAL)
for (auto i = 0; i < MOS_MAX_ENGINE_INSTANCE_PER_CLASS; i++)
{
EngineInstance[i] = 0xff;
}
#endif
}
}

};

#define MOS_VE_SUPPORTED(pOsInterface) \
Expand Down

0 comments on commit d88fdda

Please sign in to comment.