mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibC: Don't clobber errno in free().
This one is a bit mysterious. I can't find any authoritative answer on what the correct behavior is, but it seems reasonable to me that free() doesn't step on errno, since it returns "void" and thus the caller won't know to inspect errno anyway.
This commit is contained in:
parent
3048e4b9f5
commit
a6b5bb439c
Notes:
sideshowbarker
2024-07-19 13:03:26 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a6b5bb439ca
1 changed files with 3 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
#include <AK/Bitmap.h>
|
||||
#include <AK/InlineLinkedList.h>
|
||||
#include <AK/ScopedValueRollback.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/CLock.h>
|
||||
#include <assert.h>
|
||||
|
@ -204,6 +205,8 @@ void* malloc(size_t size)
|
|||
|
||||
void free(void* ptr)
|
||||
{
|
||||
ScopedValueRollback rollback(errno);
|
||||
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue