mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:37:36 +00:00
Kernel: Make Region weakable and use WeakPtr<Region> instead of Region*
This turns use-after-free bugs into null pointer dereferences instead.
This commit is contained in:
parent
79576f9280
commit
30a8991dbf
5 changed files with 14 additions and 8 deletions
|
@ -27,6 +27,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/PurgeableVMObject.h>
|
||||
|
||||
|
@ -42,7 +43,7 @@ private:
|
|||
|
||||
pid_t pid;
|
||||
unsigned count { 0 };
|
||||
Region* region { nullptr };
|
||||
WeakPtr<Region> region;
|
||||
};
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue