diff options
author | Guilherme Felipe <guilhermefelipecgs@gmail.com> | 2018-05-26 15:58:12 -0300 |
---|---|---|
committer | Guilherme Felipe <guilhermefelipecgs@gmail.com> | 2018-05-26 15:56:35 -0300 |
commit | aa174d963df943ba8a763a57a51888e3a37c2fe0 (patch) | |
tree | 4417d96820879a17ea4e9cb9fc9eb2052cf77409 /platform/x11 | |
parent | c0d37123050f0bbc04b42f3073ee22a657528190 (diff) |
Fix memory leak in set_custom_mouse_cursor
Diffstat (limited to 'platform/x11')
-rw-r--r-- | platform/x11/os_x11.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 7b514d0f90..efa55ddf58 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -2463,7 +2463,7 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c cursor_image->yhot = p_hotspot.y; // allocate memory to contain the whole file - cursor_image->pixels = (XcursorPixel *)malloc(size); + cursor_image->pixels = (XcursorPixel *)memalloc(size); image->lock(); @@ -2489,6 +2489,9 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c if (p_shape == CURSOR_ARROW) { XDefineCursor(x11_display, x11_window, cursors[p_shape]); } + + memfree(cursor_image->pixels); + XcursorImageDestroy(cursor_image); } else { // Reset to default system cursor if (img[p_shape]) { |