summaryrefslogtreecommitdiff
path: root/src/gl
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-23 13:28:11 -0500
committersanine <sanine.not@pm.me>2022-08-23 13:28:11 -0500
commit25ed7eb9f84e9a822f698ad803901fbb2a5354cf (patch)
tree48ea34e893cd60fdc1ef1b694e22cde857cf2e51 /src/gl
parentae4e17fc743ca0344af818ab767db7311ea7829c (diff)
fix memory leak
Diffstat (limited to 'src/gl')
-rw-r--r--src/gl/window.c5
1 files changed, 5 insertions, 0 deletions
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;
}