From 25ed7eb9f84e9a822f698ad803901fbb2a5354cf Mon Sep 17 00:00:00 2001 From: sanine Date: Tue, 23 Aug 2022 13:28:11 -0500 Subject: fix memory leak --- src/gl/window.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gl/window.c b/src/gl/window.c index 1b8c4bb..fd13022 100644 --- a/src/gl/window.c +++ b/src/gl/window.c @@ -98,6 +98,11 @@ int window_destroy(lua_State *L) void *ptr; hs_parse_args(L, hs_light(ptr)); GLFWwindow *win = ptr; + void *wdata = glfwGetWindowUserPointer(win); + if (wdata != NULL) { + free(wdata); + glfwSetWindowUserPointer(win, NULL); + } glfwDestroyWindow(win); return 0; } -- cgit v1.2.1