Fix some memory mismanagement

This commit is contained in:
MysterD 2023-05-13 02:42:35 -07:00
parent d74a67ee10
commit 093754ae1b
3 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,8 @@ void DynOS_AmbientT_Load(BinFile *aFile, GfxData *aGfxData) {
_Node->mName.Read(aFile);
// Data
_Node->mData = New<Ambient_t>();
// HACK: allocate for Light_t size due to PC port rendering all ambients as lights
_Node->mData = (Ambient_t*)New<Light_t>();
*_Node->mData = aFile->Read<Ambient_t>();
// Append

View File

@ -55,9 +55,9 @@ void *DynOS_SwapCmd(void *aCmd) {
void *DynOS_UpdateCmd(void *aCmd) {
if (!aCmd) { return NULL; }
static const uintptr_t sCmdLevelEntry[] = { CALL(0, lvl_init_or_update) };
if (!sCmdLevelEntry) { return NULL; }
sDynosIsLevelEntry |= (memcmp(aCmd, sCmdLevelEntry, sizeof(sCmdLevelEntry)) == 0);
sDynosIsLevelEntry |= (((uintptr_t*)aCmd)[0] == sCmdLevelEntry[0] && ((uintptr_t*)aCmd)[1] == sCmdLevelEntry[1]);
return DynOS_Warp_Update(aCmd, sDynosIsLevelEntry);
}

View File

@ -187,7 +187,6 @@ void DynOS_Actor_ModShutdown() {
for (auto it = _ValidActors.cbegin(); it != _ValidActors.cend();) {
auto& actorGfx = it->second;
if (actorGfx.mPackIndex == MOD_PACK_INDEX) {
free(actorGfx.mGraphNode);
DynOS_Gfx_Free(actorGfx.mGfxData);
_ValidActors.erase(it++);
} else {