diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-04-04 15:06:57 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-04-04 19:49:50 +0200 |
commit | f8ab79e68af20e18e1d868b64d6dfd0c429bc554 (patch) | |
tree | a9d2df2e2df939c189135b1c36a01e06b37b80b2 /core/os | |
parent | 53317bbe146dd19a919685df8d846c55568daba1 (diff) |
Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
Diffstat (limited to 'core/os')
-rw-r--r-- | core/os/memory.h | 6 | ||||
-rw-r--r-- | core/os/os.h | 2 | ||||
-rw-r--r-- | core/os/pool_allocator.h | 8 |
3 files changed, 7 insertions, 9 deletions
diff --git a/core/os/memory.h b/core/os/memory.h index 27eaad5010..baa96ef3e9 100644 --- a/core/os/memory.h +++ b/core/os/memory.h @@ -186,9 +186,9 @@ void memdelete_arr(T *p_class) { struct _GlobalNil { int color = 1; - _GlobalNil *right; - _GlobalNil *left; - _GlobalNil *parent; + _GlobalNil *right = nullptr; + _GlobalNil *left = nullptr; + _GlobalNil *parent = nullptr; _GlobalNil(); }; diff --git a/core/os/os.h b/core/os/os.h index 808d704b3d..b3c66ff18c 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -60,8 +60,6 @@ class OS { bool _stdout_enabled = true; bool _stderr_enabled = true; - char *last_error; - CompositeLogger *_logger = nullptr; bool restart_on_exit = false; diff --git a/core/os/pool_allocator.h b/core/os/pool_allocator.h index 11a252bc54..0919a024e2 100644 --- a/core/os/pool_allocator.h +++ b/core/os/pool_allocator.h @@ -75,13 +75,13 @@ private: typedef int EntryArrayPos; typedef int EntryIndicesPos; - Entry *entry_array; - int *entry_indices; + Entry *entry_array = nullptr; + int *entry_indices = nullptr; int entry_max; int entry_count; - uint8_t *pool; - void *mem_ptr; + uint8_t *pool = nullptr; + void *mem_ptr = nullptr; int pool_size; int free_mem; |