From 5441047c8e555bd4c8123d5814537c4e46b7aaf7 Mon Sep 17 00:00:00 2001 From: Hidenori Matsubayashi Date: Fri, 3 Mar 2023 06:22:52 +0900 Subject: [PATCH] Fix double free or corruption exception (flutter/engine#39880) Fix double free or corruption exception (GLFW_drm example) --- engine/src/flutter/examples/glfw_drm/FlutterEmbedderGLFW.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/examples/glfw_drm/FlutterEmbedderGLFW.cc b/engine/src/flutter/examples/glfw_drm/FlutterEmbedderGLFW.cc index d75811092f..ef9435b885 100644 --- a/engine/src/flutter/examples/glfw_drm/FlutterEmbedderGLFW.cc +++ b/engine/src/flutter/examples/glfw_drm/FlutterEmbedderGLFW.cc @@ -153,7 +153,10 @@ bool RunFlutter(GLFWwindow* window, config.open_gl.present_with_info = [](void* userdata, const FlutterPresentInfo* info) -> bool { // Free the existing damage that was allocated to this frame. - free(existing_damage_map_[info->fbo_id]); + if (existing_damage_map_[info->fbo_id] != nullptr) { + free(existing_damage_map_[info->fbo_id]); + existing_damage_map_[info->fbo_id] = nullptr; + } // Get list of extensions. const char* extensions = eglQueryString(display_, EGL_EXTENSIONS);