### 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
image_memory_barrier.subresourceRange.baseMipLevel = dst_tex->base_mipmap;
			image_memory_barrier.subresourceRange.levelCount = 1;
			image_memory_barrier.subresourceRange.baseArrayLayer = dst_tex->base_layer;
			image_memory_barrier.subresourceRange.layerCount = 1;
			vkCmdPipelineBarrier(command_buffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
		}
		
		{
			VkImageResolve image_copy_region;
			image_copy_region.srcSubresource.aspectMask = src_tex->read_aspect_mask;
			image_copy_region.srcSubresource.baseArrayLayer = src_tex->base_layer;
			image_copy_region.srcSubresource.layerCount = 1;
			image_copy_region.srcSubresource.mipLevel = src_tex->base_mipmap;
			image_copy_region.srcOffset.x = 0;
			image_copy_region.srcOffset.y = 0;
			image_copy_region.srcOffset.z = 0;
			image_copy_region.dstSubresource.aspectMask = dst_tex->read_aspect_mask;
			image_copy_region.dstSubresource.baseArrayLayer = dst_tex->base_layer;
			image_copy_region.dstSubresource.layerCount = 1;
			image_copy_region.dstSubresource.mipLevel = dst_tex->base_mipmap;
			image_copy_region.dstOffset.x = 0;
			image_copy_region.dstOffset.y = 0;
			image_copy_region.dstOffset.z = 0;
			image_copy_region.extent.width = src_tex->width;
			image_copy_region.extent.height = src_tex->height;
			image_copy_region.extent.depth = src_tex->depth;
			vkCmdResolveImage(command_buffer, src_tex->image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_tex->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &image_copy_region);
		}
		
		uint32_t barrier_flags = 0;