Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid prematurely freeing buffer during value editing on Linux. #141

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "../../Common/CommonUtils.h"
#include "../../Common/MemoryCommon.h"

#include <cassert>
#include <cstdlib>
#include <cstring>
#include <dirent.h>
Expand Down Expand Up @@ -204,7 +203,6 @@ bool LinuxDolphinProcess::readFromRAM(const u32 offset, char* buffer, const size
break;
}
default:
assert(0 && "Unexpected type size");
break;
}
}
Expand Down Expand Up @@ -272,13 +270,13 @@ bool LinuxDolphinProcess::writeToRAM(const u32 offset, const char* buffer, const
break;
}
default:
assert(0 && "Unexpected type size");
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
3 changes: 0 additions & 3 deletions Source/DolphinProcess/Mac/MacDolphinProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "../../Common/CommonUtils.h"
#include "../../Common/MemoryCommon.h"

#include <cassert>
#include <cstdlib>
#include <mach/mach_vm.h>
#include <memory>
Expand Down Expand Up @@ -171,7 +170,6 @@ bool MacDolphinProcess::readFromRAM(const u32 offset, char* buffer, size_t size,
break;
}
default:
assert(0 && "Unexpected type size");
break;
}
}
Expand Down Expand Up @@ -231,7 +229,6 @@ bool MacDolphinProcess::writeToRAM(const u32 offset, const char* buffer, const s
break;
}
default:
assert(0 && "Unexpected type size");
break;
}
}
Expand Down
3 changes: 0 additions & 3 deletions Source/DolphinProcess/Windows/WindowsDolphinProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#ifdef UNICODE
#include <codecvt>
#endif
#include <cassert>
#include <cstdlib>
#include <string>
#include <tlhelp32.h>
Expand Down Expand Up @@ -207,7 +206,6 @@ bool WindowsDolphinProcess::readFromRAM(const u32 offset, char* buffer, const si
break;
}
default:
assert(0 && "Unexpected type size");
break;
}
}
Expand Down Expand Up @@ -268,7 +266,6 @@ bool WindowsDolphinProcess::writeToRAM(const u32 offset, const char* buffer, con
break;
}
default:
assert(0 && "Unexpected type size");
break;
}
}
Expand Down
1 change: 0 additions & 1 deletion Source/MemoryScanner/MemoryScanner.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <cassert>
#include <cmath>
#include <cstring>
#include <stack>
Expand Down
Loading