### 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
window->present_cmd_pool,
			 VK_COMMAND_BUFFER_LEVEL_PRIMARY,
			 1,
		};
		for (uint32_t i = 0; i < swapchainImageCount; i++) {
			err = vkAllocateCommandBuffers(device, &present_cmd_info,
					&window->swapchain_image_resources[i].graphics_to_present_cmd);
			ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
			const VkCommandBufferBeginInfo cmd_buf_info = {
				 VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
				 nullptr,
				 VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT,
				 nullptr,
			};
			err = vkBeginCommandBuffer(window->swapchain_image_resources[i].graphics_to_present_cmd, &cmd_buf_info);
			ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
			VkImageMemoryBarrier image_ownership_barrier = {
				 VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
				 nullptr,
				 0,
				 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
				 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
				 VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
				 graphics_queue_family_index,
				 present_queue_family_index,
				 window->swapchain_image_resources[i].image,
				 { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 }
			};
			vkCmdPipelineBarrier(window->swapchain_image_resources[i].graphics_to_present_cmd, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
					VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_ownership_barrier);