Prevent dangling pointer

This commit is contained in:
Alex
2023-03-14 06:24:02 +02:00
parent 855384aead
commit d7c9b7ab02
23 changed files with 91 additions and 90 deletions

View File

@ -39,7 +39,7 @@ namespace Execute
uintptr_t *TmpBuffer = new uintptr_t[0x1000];
*(int *)TmpBuffer = 2545;
InterProcessCommunication::IPCErrorCode ret = Process->IPC->Write(Handle->ID, TmpBuffer, 0x1000);
delete[] TmpBuffer;
delete[] TmpBuffer, TmpBuffer = nullptr;
debug("Write returned %d", ret);
if (ret == InterProcessCommunication::IPCErrorCode::IPCNotListening)
{
@ -57,7 +57,7 @@ namespace Execute
void ELFInterpreterThreadWrapper()
{
ELFInterpreterIPCThread(InterpreterTargetProcess, (char *)InterpreterTargetPath->c_str(), InterpreterMemoryImage, InterpreterNeededLibraries);
delete InterpreterTargetPath;
delete InterpreterTargetPath, InterpreterTargetPath = nullptr;
return;
}
@ -206,7 +206,7 @@ namespace Execute
Thread->Memory->Add(p.Address, p.PageCount);
bl.TmpMem->DetachAddress(p.Address);
}
delete bl.TmpMem;
delete bl.TmpMem, bl.TmpMem = nullptr;
bl.sd.Process = Process;
bl.sd.Thread = Thread;