DescentDevelopers / Descent3

Descent 3 by Outrage Entertainment
GNU General Public License v3.0
2.74k stars 231 forks source link

Fixed double delete/free in rend_Screenshot(). #348

Closed pzychotic closed 2 months ago

pzychotic commented 2 months ago

Pull Request Type

Description

I got crashes when saving Savegames on Windows in rend_Screenshot() that are introduced with 80c207d.

The auto screenshot in the beginning of that function is a std::unique_ptr<NewBitmap>. The following auto *temp_data is a raw pointer to NewBitmap::_data which itself is a std::unique_ptr. So the mem_free(temp_data) at the end of that function was freeing the memory held by _data and the auto screenshot going out of scope after that, was trying to delete that memory again through the dtor of the std::unique_ptr.

Related Issues

Screenshots (if applicable)

Checklist

Additional Comments

JeodC commented 2 months ago

I'll have to try this tonight, I didn't get any crashes when testing png on windows--and I used a savegame.