### Godot version

master CI builds

### System information

Linux / Editor with doubles and GCC sanitizers

### Issue description

The `Linux / Editor with doubles and GCC sanitizers` build can fail with a `attempting free on address which was not malloc()-ed` crash in the `Open and close editor (Vulkan)` step.

https://github.com/godotengine/godot/actions/runs/5366302204/jobs/9735786296#step:15:138
https://github.com/godotengine/godot/actions/runs/5389199469/jobs/9783070708?pr=78740#step:15:138

The failure doesn't seem related to either PR (in fact one of them is just a docs change). I have only seen this issue these two times, still probably worth looking into.

### Steps to reproduce

Open and close https://github.com/godotengine/regression-test-project/archive/4.0.zip using the Vulkan renderer.

### Minimal reproduction project

https://github.com/godotengine/regression-test-project/archive/4.0.zip
description.stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE;
						description.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
					} else {
						description.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
						description.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
						description.finalLayout = VK_IMAGE_LAYOUT_UNDEFINED; 
					}
				} break;
				default: {
					ERR_FAIL_V(VK_NULL_HANDLE); 
				}
			}
		}
		attachment_last_pass[i] = -1;
		attachment_remap.push_back(attachments.size());
		attachments.push_back(description);
	}
	LocalVector<VkSubpassDescription2KHR> subpasses;
	LocalVector<LocalVector<VkAttachmentReference2KHR>> color_reference_array;
	LocalVector<LocalVector<VkAttachmentReference2KHR>> input_reference_array;
	LocalVector<LocalVector<VkAttachmentReference2KHR>> resolve_reference_array;
	LocalVector<LocalVector<uint32_t>> preserve_reference_array;
	LocalVector<VkAttachmentReference2KHR> depth_reference_array;
	LocalVector<VkAttachmentReference2KHR> vrs_reference_array;
	LocalVector<VkFragmentShadingRateAttachmentInfoKHR> vrs_attachment_info_array;
	subpasses.resize(p_passes.size());
	color_reference_array.resize(p_passes.size());
	input_reference_array.resize(p_passes.size());
	resolve_reference_array.resize(p_passes.size());
	preserve_reference_array.resize(p_passes.size());