Kenix3 / libultraship

Porting games to the PC
MIT License
90 stars 64 forks source link

Fix memory leaks in DisplayListFactory. #532

Closed Kenix3 closed 1 week ago

Kenix3 commented 2 weeks ago

https://github.com/Kenix3/libultraship/blob/3d2e6bc128a105f0cba9109573a2401a8ba43f49/src/resource/factory/DisplayListFactory.cpp#L276 https://github.com/Kenix3/libultraship/blob/3d2e6bc128a105f0cba9109573a2401a8ba43f49/src/resource/factory/DisplayListFactory.cpp#L393 https://github.com/Kenix3/libultraship/blob/3d2e6bc128a105f0cba9109573a2401a8ba43f49/src/resource/factory/DisplayListFactory.cpp#L448 https://github.com/Kenix3/libultraship/blob/3d2e6bc128a105f0cba9109573a2401a8ba43f49/src/resource/factory/DisplayListFactory.cpp#L891 https://github.com/Kenix3/libultraship/blob/3d2e6bc128a105f0cba9109573a2401a8ba43f49/src/resource/factory/DisplayListFactory.cpp#L949 https://github.com/Kenix3/libultraship/blob/3d2e6bc128a105f0cba9109573a2401a8ba43f49/src/resource/factory/DisplayListFactory.cpp#L960 Nothing ever frees these malloc'd memory blocks. Additionally, we should not be allocating in a Resource unless the destructor frees it. These strings should be held and tracked by the resource.