1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

Kernel: Allow passing null pointer to delete

The C++ standard says that it's legal to call the `delete` operator with
a null pointer argument, in which case it should be a no-op. I
encountered this issue when running a kernel that's compiled with Clang.
I assume this fact was used for some kind of optimization.
This commit is contained in:
Daniel Bertalan 2021-07-12 19:17:41 +02:00 committed by Andreas Kling
parent bb26cea291
commit b847541ee8
2 changed files with 4 additions and 0 deletions

View file

@ -33,6 +33,8 @@ public: \
} \
void operator delete(void* ptr) noexcept \
{ \
if (!ptr) \
return; \
slab_dealloc(ptr, sizeof(type)); \
} \
\