diff --git a/src/window.c b/src/window.c index e15eae11..bc24582c 100644 --- a/src/window.c +++ b/src/window.c @@ -532,8 +532,9 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title) _GLFW_REQUIRE_INIT(); - _glfw_free(window->title); + char* prev = window->title; window->title = _glfw_strdup(title); + _glfw_free(prev); _glfw.platform.setWindowTitle(window, title); }