### 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
VkBufferImageCopy buffer_image_copy;
			uint32_t image_size = get_image_format_required_size(tex->format, tex->width, tex->height, tex->depth, i + 1);
			uint32_t size = image_size - prev_size;
			prev_size = image_size;
			buffer_image_copy.bufferOffset = offset;
			buffer_image_copy.bufferImageHeight = 0;
			buffer_image_copy.bufferRowLength = 0;
			buffer_image_copy.imageSubresource.aspectMask = tex->read_aspect_mask;
			buffer_image_copy.imageSubresource.baseArrayLayer = p_layer;
			buffer_image_copy.imageSubresource.layerCount = 1;
			buffer_image_copy.imageSubresource.mipLevel = i;
			buffer_image_copy.imageOffset.x = 0;
			buffer_image_copy.imageOffset.y = 0;
			buffer_image_copy.imageOffset.z = 0;
			buffer_image_copy.imageExtent.width = computed_w;
			buffer_image_copy.imageExtent.height = computed_h;
			buffer_image_copy.imageExtent.depth = computed_d;
			vkCmdCopyImageToBuffer(command_buffer, tex->image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, tmp_buffer.buffer, 1, &buffer_image_copy);
			computed_w = MAX(1u, computed_w >> 1);
			computed_h = MAX(1u, computed_h >> 1);
			computed_d = MAX(1u, computed_d >> 1);
			offset += size;
		}
		{ 
			VkImageMemoryBarrier image_memory_barrier;
			image_memory_barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
			image_memory_barrier.pNext = nullptr;
			image_memory_barrier.srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
			image_memory_barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
			if (tex->usage_flags & TEXTURE_USAGE_STORAGE_BIT) {