Skip to content

[2.X | PSP] Fix memdelete_arr mismatch - #29

Open
pauloBFalmeida wants to merge 1 commit into
Homebrodot:main/2.1from
pauloBFalmeida:fix-psp-memory-free
Open

pauloBFalmeida wants to merge 1 commit into
Homebrodot:main/2.1from
pauloBFalmeida:fix-psp-memory-free

Conversation

@pauloBFalmeida

Copy link
Copy Markdown

skinned_buffer is allocated with memnew_arr in RasterizerPSP::init(),

void RasterizerPSP::init() {
  // ...
  skinned_buffer = memnew_arr( uint8_t, skinned_buffer_size );

But freed it with memdelete in RasterizerPSP::finish()

void RasterizerPSP::finish() {
	memdelete(skinned_buffer);
}

Corrupting the heap and crashing on shutdown.

Change

In platform/psp/rasterizer_psp.cpp:

 void RasterizerPSP::finish() {
-	memdelete(skinned_buffer);
+	memdelete_arr(skinned_buffer);
 }

Problem

Calling get_tree().quit() caused a Bad memory access detected crash. The game froze and the PSP had to be restarted.

Result

get_tree().quit() now closes the game correctly and the crash is gone.

Testing

  • PPSSPP: the game exits cleanly.
  • Real PSP 1000: the game closes and the console doesn't need to be restarted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant