Skip to content

Commit 8c119e1

Browse files
committed
Merge pull request #112363 from ryevdokimov/jolt-handle-nullptr
Jolt: Add null checks to `jolt_free` and `jolt_aligned_free`
2 parents 56f26f3 + f7b7c08 commit 8c119e1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/jolt_physics/jolt_globals.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ void *jolt_realloc(void *p_mem, size_t p_old_size, size_t p_new_size) {
5353
}
5454

5555
void jolt_free(void *p_mem) {
56+
if (unlikely(p_mem == nullptr)) {
57+
return;
58+
}
5659
Memory::free_static(p_mem);
5760
}
5861

@@ -61,6 +64,9 @@ void *jolt_aligned_alloc(size_t p_size, size_t p_alignment) {
6164
}
6265

6366
void jolt_aligned_free(void *p_mem) {
67+
if (unlikely(p_mem == nullptr)) {
68+
return;
69+
}
6470
Memory::free_aligned_static(p_mem);
6571
}
6672

0 commit comments

Comments
 (0)