Browse Source

Correct logic for tracking allocator proc for freeing a nil pointer

gingerBill 3 years ago
parent
commit
e10105a780
1 changed files with 1 additions and 1 deletions
  1. 1 1
      core/mem/allocators.odin

+ 1 - 1
core/mem/allocators.odin

@@ -858,7 +858,7 @@ tracking_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
 
 
 	result: []byte
 	result: []byte
 	err: Allocator_Error
 	err: Allocator_Error
-	if mode == .Free && old_memory not_in data.allocation_map {
+	if mode == .Free && old_memory != nil && old_memory not_in data.allocation_map {
 		append(&data.bad_free_array, Tracking_Allocator_Bad_Free_Entry{
 		append(&data.bad_free_array, Tracking_Allocator_Bad_Free_Entry{
 			memory = old_memory,
 			memory = old_memory,
 			location = loc,
 			location = loc,