### 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
_THREAD_SAFE_METHOD_
	ERR_FAIL_COND_V_MSG(draw_list != nullptr, INVALID_ID, "Only one draw list can be active at the same time.");
	ERR_FAIL_COND_V_MSG(compute_list != nullptr && !compute_list->state.allow_draw_overlap, INVALID_ID, "Only one draw/compute list can be active at the same time.");
	Framebuffer *framebuffer = framebuffer_owner.get_or_null(p_framebuffer);
	ERR_FAIL_COND_V(!framebuffer, INVALID_ID);
	Point2i viewport_offset;
	Point2i viewport_size = framebuffer->size;
	bool needs_clear_color = false;
	bool needs_clear_depth = false;
	if (p_region != Rect2() && p_region != Rect2(Vector2(), viewport_size)) { 
		Rect2i viewport(viewport_offset, viewport_size);
		Rect2i regioni = p_region;
		if (!(regioni.position.x >= viewport.position.x) && (regioni.position.y >= viewport.position.y) &&
				((regioni.position.x + regioni.size.x) <= (viewport.position.x + viewport.size.x)) &&
				((regioni.position.y + regioni.size.y) <= (viewport.position.y + viewport.size.y))) {
			ERR_FAIL_V_MSG(INVALID_ID, "When supplying a custom region, it must be contained within the framebuffer rectangle");
		}
		viewport_offset = regioni.position;
		viewport_size = regioni.size;
		if (p_initial_color_action == INITIAL_ACTION_CLEAR_REGION_CONTINUE) {
			needs_clear_color = true;
			p_initial_color_action = INITIAL_ACTION_CONTINUE;
		}
		if (p_initial_depth_action == INITIAL_ACTION_CLEAR_REGION_CONTINUE) {
			needs_clear_depth = true;
			p_initial_depth_action = INITIAL_ACTION_CONTINUE;
		}