Fix a couple of memory leaks (#342)

This commit is contained in:
Anders Jenbo 2025-06-19 05:55:22 +02:00 committed by GitHub
parent 105afede35
commit a0c896a0b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -97,6 +97,8 @@ void LegoInputManager::Destroy()
if (m_controlManager) { if (m_controlManager) {
delete m_controlManager; delete m_controlManager;
} }
SDL_free(m_joyids);
} }
// FUNCTION: LEGO1 0x1005c0f0 // FUNCTION: LEGO1 0x1005c0f0
@ -151,7 +153,9 @@ MxResult LegoInputManager::GetJoystick()
} }
MxS32 numJoysticks = 0; MxS32 numJoysticks = 0;
m_joyids = SDL_GetJoysticks(&numJoysticks); if (m_joyids == NULL) {
m_joyids = SDL_GetJoysticks(&numJoysticks);
}
if (m_useJoystick != FALSE && numJoysticks != 0) { if (m_useJoystick != FALSE && numJoysticks != 0) {
MxS32 joyid = m_joystickIndex; MxS32 joyid = m_joystickIndex;

View File

@ -819,6 +819,9 @@ HRESULT Direct3DRMViewportImpl::Pick(float x, float y, LPDIRECT3DRMPICKEDARRAY*
}); });
*pickedArray = new Direct3DRMPickedArrayImpl(hits.data(), hits.size()); *pickedArray = new Direct3DRMPickedArrayImpl(hits.data(), hits.size());
for (PickRecord& hit : hits) {
hit.frameArray->Release();
}
return D3DRM_OK; return D3DRM_OK;
} }