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); _Node->mName.Read(aFile);
// Data // 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>(); *_Node->mData = aFile->Read<Ambient_t>();
// Append // Append

View File

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

View File

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