Skip to content

Commit

Permalink
Avoid prematurely freeing buffer during value editing on Linux.
Browse files Browse the repository at this point in the history
This was a regression in d58cd76, where the deletion of
the `bufferCopy` buffer was moved to an earlier point. It was overlooked
that the buffer is referenced by the `local` structure that used in the
`process_vm_writev()` call.
  • Loading branch information
cristian64 committed May 16, 2024
1 parent 8e5fd21 commit 8936d78
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,10 @@ bool LinuxDolphinProcess::writeToRAM(const u32 offset, const char* buffer, const
break;
}
}
delete[] bufferCopy;

const ssize_t nwrote{process_vm_writev(m_PID, &local, 1, &remote, 1, 0)};
delete[] bufferCopy;

if (nwrote == -1)
{
// A more specific error type should be available in `errno` (if ever interested).
Expand Down

0 comments on commit 8936d78

Please sign in to comment.